Check if a Number is Positive or Negative using if else
public class PositiveNegative {

    public static void main(String[] args) {

        double number = 12.3;

        // true if number is less than 0
        if (number < 0.0)
            System.out.println(number + " is a negative number.");

        // true if number is greater than 0
        else if ( number > 0.0)
            System.out.println(number + " is a positive number.");

        // if both test expression is evaluated to false
            System.out.println(number + " is 0.");

When you run the program, the yield will be: 

12.3 is a positive number. 

In the event that you change the estimation of number to a negative number (say - 12.3), the yield will be: 

- 12.3 is a negative number. 

In the above program, it is very clear how factor number is checked to be certain or negative, by contrasting it with 0.

Java Program to Check Whether a Number is Palindrome or Not