Short-Circuit Evaluation with Logical OR
What is printed when the following code segment is executed?
public class Main {
public static void main(String[] args) {
int a = 3, b = 5;
if(a < b || a++ > 3)
System.out.println(a);
else
System.out.println(b);
}
}
A
4
B
3
C
5
D
Compilation Error
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | dobaonam8386 | 2 | 2 | 0m 38s | 162 |
| #2 | sgarv2513 | 1 | 1 | 0m 00s | 100 |
| #3 | lukeydragon27 | 1 | 1 | 0m 00s | 100 |
| #4 | 27patelp | 1 | 1 | 0m 18s | 82 |
| #5 | psak12 | 1 | 1 | 0m 56s | 44 |
| #6 | thuyjerry | 0 | 1 | 0m 05s | -15 |
| #7 | y.seong2027 | 1 | 3 | 3m 21s | -121 |
| #8 | suhanakochhar006 | 1 | 1 | 4m 54s | -194 |
APFIVE