Intermediate
Kotlin
Q92 / 100
What are Kotlin value classes used for instead of type aliases?
Correct! Well done.
Incorrect.
The correct answer is B) Value classes create truly distinct types for type-safety while being erased to the underlying type at runtime
B
Correct Answer
Value classes create truly distinct types for type-safety while being erased to the underlying type at runtime
Explanation
@JvmInline value class Email(val value: String) creates a type distinct from String — passing a String where Email is expected is a compile error, unlike a type alias.
Progress
92/100