public class T {
public int f(int n) {
if (n > 0) return 1;
}
}
// ...What is the result?
- A
Returns 1
- B
Returns 0 by default
- Ccheck_circle
Compile-time error: missing return statement
- D
Run-time error
Explanation
All paths in a non-void method must return a value; the compiler reports a missing return.