| preferred AP College board partner for AP classes
medium Solved by 12 students
Short-Circuit Evaluation with Logical OR
< Prev
Next >

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

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1dobaonam838622 0m 38s 162
#2sgarv251311 0m 00s 100
#3lukeydragon2711 0m 00s 100
#427patelp11 0m 18s 82
#5psak1211 0m 56s 44
#6thuyjerry01 0m 05s -15
#7y.seong202713 3m 21s -121
#8suhanakochhar00611 4m 54s -194
APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy