A comparison like 3 > 2 produces a boolean — true or false. A boolean holds only these two values (not 1/0).
3 > 2
boolean
true
false
1
0
boolean ready = (3 > 2); System.out.println(ready); // true
▶ Try it: run this, then change something and run it again.
What does System.out.println(3 > 2); print?
System.out.println(3 > 2);
True or false?
Type exactly what this prints:
boolean b = (10 > 3); System.out.println(b);
Write the body of isPositive that takes an int n and returns true when n is greater than 0, and false otherwise.
isPositive
int n
n
For example, isPositive(5) returns true; isPositive(-2) returns false.
isPositive(5)
isPositive(-2)