Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 3 students

Java If-Else If-Else Logic

Mark
< Prev
Next >

What is the output of the following code segment?

public class Main {
    public static void main(String[] args) {
        int x = 4;
        if(x > 5) {
            System.out.println("Greater than 5");
        } else if(x == 5) {
            System.out.println("Equal to 5");
        } else {
            System.out.println("Less than 5");
        }
    }
}
A

Greater than 5

B

No output

C

Equal to 5

D

Less than 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
Total Time
Score
#1mahmoudjibrin0811 0m 00s 100
#2lsj0803092211 0m 00s 100
#3psak1211 0m 11s 89
Items per page:
10
1 – 3 of 3

AI Tutor

How can I help?

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