| preferred AP College board partner for AP classes
easy Solved by 7 students
If Else Statement Syntax Error
< Prev
Next >

Which of the following best describes the compilation error in the code segment below?

public class Test {
    public static void main(String[] args) {
        if(5 > 3)
            System.out.println("Hello");
        else
            System.out.println("World")
    }
}
A

The else block must be enclosed in curly braces.

B

The statement in the else block is missing a semicolon at the end.

C

The main method’s return type is declared incorrectly.

D

The if condition is written with an incorrect relational operator.

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
#1kazvin.tjakradinata11 0m 06s 94
#2y.seong202711 0m 08s 92
#3namansoin00011 0m 25s 75
#4hitrishabhatia14 0m 00s 70
#5chunxiangxu.cxu01 59m 54s -3,604
#6bommasam00023 18h 01m -64,678
Items per page:
10
1 – 6 of 6
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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