If Statement Without Braces
What is printed as a result of executing the following code?
public class SwapTest {
public static void main(String[] args) {
int x = 3, y = 5;
if(x > y)
x = y;
y = x;
System.out.println(x + " " + y);
}
}
A
3 3
B
Compilation error
C
5 5
D
3 5
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | hitrishabhatia | 1 | 4 | 0m 00s | 70 |
| #2 | kazvin.tjakradinata | 1 | 2 | 0m 58s | 32 |
| #3 | y.seong2027 | 1 | 2 | 1m 36s | -6 |
| #4 | chunxiangxu.cxu | 0 | 1 | 0m 32s | -42 |
| #5 | jebaksar000 | 0 | 1 | 0m 44s | -54 |
| #6 | bommasam000 | 1 | 6 | 2m 31s | -101 |
| #7 | isaact.taylor52 | 0 | 1 | 1m 50s | -120 |
| #8 | namansoin000 | 0 | 1 | 4m 00s | -250 |
| #9 | suhanakochhar006 | 1 | 4 | 8m 56s | -466 |
Items per page:
10
1 – 9 of 9
APFIVE