public static int run() {
int x = 1;
int y = 1;
if (++x == 2 || ++y == 2) {
x = x + y;
}
return x * 10 + y;
}
// Call: System.out.println(run());What is printed?
- A
42
- Bcheck_circle
31
- C
32
- D
41
Explanation
++x makes x=2; comparison true. || short-circuits so y stays 1. x = x+y = 3. Result 3*10+1 = 31.