| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
medium Solved by 28 students
Invalid Character Literal Assignment
< Prev
Next >

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

Incorrect main method parameter type.

B

A char literal must contain exactly one character; ‘AB’ is invalid.

C

Missing semicolon after the declaration of letter.

D

Letter is used before declaration.

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
#1ngvandangthanh22 0m 00s 200
#2bommasam00011 0m 13s 87
#310818526511 0m 16s 84
#4manveergunesani11 0m 17s 83
#5patrickmeijer00911 0m 17s 83
#6lsj0803092211 0m 36s 64
#7parth.taur22711 0m 45s 55
#8y.seong202711 0m 51s 49
#9demosolasis111 1m 11s 29
#10theofanusmischa11 1m 24s 16
Items per page:
10
1 – 10 of 13

AI Tutor

How can I help?

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