int x = 5;
int y = 0;
if (x > 0)
y++;
y++;
System.out.println(y);What is printed?
- Acheck_circle
2
- B
1
- C
0
- D
compile error
Explanation
Without braces, only the FIRST y++ is conditional on the if. The second y++ always executes. With x > 0 true, both run. y becomes 2. (Indentation is misleading.)