🐦 Kotlin Beginner

What does the Any type represent in Kotlin?

Answer

Any is the root of the Kotlin class hierarchy — every non-nullable Kotlin class is a subtype of Any. It is equivalent to Java's Object. Any provides three methods that all classes inherit: equals(), hashCode(), and toString(). For nullable types, Any? is the supertype of all types including nullable ones. Unlike Java, Kotlin's primitive types (Int, Boolean, Double) are also subtypes of Any — they are represented as JVM primitives for performance but behave as objects in Kotlin's type system.