Bird
0
0

Which of the following types is NOT a subtype of Any in Kotlin?

easy📝 Conceptual Q2 of 15
Kotlin - Data Types
Which of the following types is NOT a subtype of Any in Kotlin?
AAny?
BInt
CString
DBoolean
Step-by-Step Solution
Solution:
  1. Step 1: Identify subtypes of Any

    All non-nullable types like String, Int, and Boolean inherit from Any.
  2. Step 2: Understand Any? type

    Any? is a nullable version of Any, so it is not a subtype but a nullable supertype.
  3. Final Answer:

    Any? is not a subtype of Any. -> Option A
  4. Quick Check:

    Nullable Any? ≠ subtype of Any [OK]
Quick Trick: Nullable Any? is different from Any, watch nullability [OK]
Common Mistakes:
MISTAKES
  • Assuming Any? is subtype of Any
  • Confusing nullable and non-nullable types
  • Ignoring Kotlin's null safety system

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes