Bird
0
0

Which of the following is the correct way to declare a Char literal in Kotlin?

easy📝 Syntax Q3 of 15
Kotlin - Data Types
Which of the following is the correct way to declare a Char literal in Kotlin?
A"A"
B<A>
C`A`
D'A'
Step-by-Step Solution
Solution:
  1. Step 1: Recall Kotlin Char literal syntax

    In Kotlin, a Char literal is enclosed in single quotes, like 'A'.
  2. Step 2: Identify correct option

    Double quotes are for strings, backticks are for identifiers, and angle brackets are invalid here.
  3. Final Answer:

    'A' -> Option D
  4. Quick Check:

    Char literals use single quotes 'A' [OK]
Quick Trick: Char literals use single quotes in Kotlin [OK]
Common Mistakes:
MISTAKES
  • Using double quotes which create String
  • Using backticks which are for identifiers
  • Using angle brackets which are invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes