Else Without If Compilation Error
Which of the following describes the compilation error produced by the code segment below?
public class Test {
public static void main(String[] args) {
else {
System.out.println("No corresponding if statement.");
}
}
}
A
The System.out.println statement is formatted incorrectly.
B
The main method should include a return statement.
C
The else statement is used without a preceding if statement.
D
The class declaration is missing necessary keywords.
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | bommasam000 | 4 | 4 | 2m 37s | 243 |
| #2 | 27patelp | 2 | 2 | 0m 00s | 200 |
| #3 | hitrishabhatia | 1 | 1 | 0m 00s | 100 |
| #4 | kazvin.tjakradinata | 1 | 1 | 0m 06s | 94 |
| #5 | chunxiangxu.cxu | 1 | 1 | 0m 20s | 80 |
| #6 | y.seong2027 | 1 | 1 | 0m 26s | 74 |
| #7 | namansoin000 | 1 | 1 | 0m 32s | 68 |
| #8 | suhanakochhar006 | 1 | 1 | 1m 09s | 31 |
Items per page:
10
1 – 8 of 8
APFIVE