← Unit 1 · all exercises
Saved in this browser only

Positive or not

Return true when the number is greater than zero, and false otherwise. Zero itself is not positive.

boolean isPositive(int n)

Solution.java
Loading editor…
Results

Examples

  • isPositive(5) → true
  • isPositive(-5) → false

There are also 3 hidden tests you can't see. Solve the problem, not the examples.