public static int isPositive(int n) {
return n > 0;
}What is wrong?
- A
The method must be void
- B
Nothing is wrong
- Ccheck_circle
Return type must be boolean to match the expression n > 0
- D
n must be checked with .equals
Explanation
n > 0 yields a boolean; an int return type produces a compile error. Change the type to boolean.