# Java Program to Check Number is Positive or Negative

Last Updated: 09 August, 2022

On this tutorial page we are going to learn how to write a Java program to check whether the number is positive or negative.

Please understand the below points before going through the Java program implementation:

If a number is greater than zero (number > 0), then that number is a positive.

For Example: 1, 2, 3, 4.....

If a number is less than zero (number < 0) then that number is a negative.

For Example: -1, -2, -3, -4.....

If a number is equal to zero (number == 0) then that number is not a positive or negative.

For Example: 0

Let's see the Java program implementation.

## Program 1: Check whether the number is positive or negative

Output

50 is a positve number.

-20 is a negative number.

The number is 0.

## Program 2: Check whether the number is positive or negative using Scanner class (user input)

Output 1 :

Enter the number: 51

51.0 is a positve number.

Output 2 :

Enter the number: -286.76

-286.76 is a negative number.

That's all guys, hope this Java Program is helpful for you.

Happy Learning... 😀

Please share this article on social media to help others.

If you have any query or suggestion regarding this artical please share with us

`feedback@javabytechie.com`