| preferred AP College board partner for AP classes
medium Solved by 10 students
If Statement Without Braces
< Prev
Next >

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

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hitrishabhatia14 0m 00s 70
#2kazvin.tjakradinata12 0m 58s 32
#3y.seong202712 1m 36s -6
#4chunxiangxu.cxu01 0m 32s -42
#5jebaksar00001 0m 44s -54
#6bommasam00016 2m 31s -101
#7isaact.taylor5201 1m 50s -120
#8namansoin00001 4m 00s -250
#9suhanakochhar00614 8m 56s -466
Items per page:
10
1 – 9 of 9
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy