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
Compilation Error
B
4
C
5
D
3
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kazvin.tjakradinata | 3 | 3 | 0m 44s | 256 |
| #2 | dobaonam8386 | 2 | 2 | 0m 38s | 162 |
| #3 | lukeydragon27 | 1 | 1 | 0m 00s | 100 |
| #4 | sgarv2513 | 1 | 1 | 0m 00s | 100 |
| #5 | rsenatatar | 1 | 1 | 0m 03s | 97 |
| #6 | chunxiangxu.cxu | 1 | 1 | 0m 15s | 85 |
| #7 | 27patelp | 1 | 1 | 0m 18s | 82 |
| #8 | namansoin000 | 1 | 1 | 0m 28s | 72 |
| #9 | psak12 | 1 | 1 | 0m 56s | 44 |
| #10 | thuyjerry | 0 | 1 | 0m 05s | -15 |
Items per page:
10
1 – 10 of 13
