← Unit 2 · all exercises
Saved in this browser only

Both above zero

Return true only when both numbers are greater than zero.

boolean bothPositive(int a, int b)

Solution.java
Loading editor…
Results

Examples

  • bothPositive(3, 4) → true
  • bothPositive(3, -4) → false

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