Are you taking CLEP classes? Try clep.ai
| 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 15 students

Invalid Character Literal Assignment

Mark
< 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

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.

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
#1ngvandangthanh22 0m 00s 200
#2zhenmunse11 0m 02s 98
#3Potter1611 0m 07s 93
#4bommasam00011 0m 13s 87
#510818526511 0m 16s 84
#6manveergunesani11 0m 17s 83
#7patrickmeijer00911 0m 17s 83
#8lsj0803092211 0m 36s 64
#9Wilbert.Ankomah2711 0m 39s 61
#10parth.taur22711 0m 45s 55
Items per page:
10
1 – 10 of 17

AI Tutor

How can I help?

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