Data, Sealed & Value Classes

KOTLIN › Types & Classes

Kotlin's data, sealed, and value classes and choosing between enum and sealed.

Interviewers use these to probe how well you know Kotlin's modeling primitives and their compiler-generated behavior. Expect questions on what data classes generate and exclude, why sealed hierarchies make 'when' exhaustive, and how value classes give zero-overhead type safety. Knowing the exact constraints and runtime trade-offs separates idiomatic Kotlin from Java-in-Kotlin.

What this covers

Study this topic

Further reading