Invalid Character Literal Assignment
Which of the following best describes the compile-time error produced by the code segment below?
public class Debug {
public static void main(String[] args) {
char letter = 'AB';
System.out.println(letter);
}
}
A
Letter is used before declaration.
B
A char literal must contain exactly one character; ‘AB’ is invalid.
C
Missing semicolon after the declaration of letter.
D
Incorrect main method parameter type.
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | ngvandangthanh | 2 | 2 | 0m 00s | 200 |
| #2 | zhenmunse | 1 | 1 | 0m 02s | 98 |
| #3 | Potter16 | 1 | 1 | 0m 07s | 93 |
| #4 | bommasam000 | 1 | 1 | 0m 13s | 87 |
| #5 | 108185265 | 1 | 1 | 0m 16s | 84 |
| #6 | manveergunesani | 1 | 1 | 0m 17s | 83 |
| #7 | patrickmeijer009 | 1 | 1 | 0m 17s | 83 |
| #8 | lsj08030922 | 1 | 1 | 0m 36s | 64 |
| #9 | Wilbert.Ankomah27 | 1 | 1 | 0m 39s | 61 |
| #10 | parth.taur227 | 1 | 1 | 0m 45s | 55 |
Items per page:
10
1 – 10 of 17
