Java How To Find Positive or Negative Numbers
Find Out if a Number is Positive or Negative
Find out if a number is even or odd:
Example
int myNum = 10; // Is this a positive or negative number?
if (myNum > 0) {
System.out.println("The value is a positive number.");
} else if (myNum < 0) {
System.out.println("The value is a negative number.");
} else {
System.out.println("The value is 0.");
}
Try it Yourself »