int x = 0;
int y = 5;
if (x != 0 && y / x > 1) {
System.out.println("A");
} else {
System.out.println("B");
}What is printed?
- A
A
- Bcheck_circle
B
- C
ArithmeticException
- D
nothing
Explanation
Short-circuit evaluation: x != 0 is false, so the && expression is false without evaluating y/x. No division by zero occurs. The else branch prints B.