Sobes.tech
Junior — Middle

Kes Kotlinis teenib kõiki teisi klasse põhiklassina?

sobes.tech AI

Vastus AI-lt

In Kotlin, the base class for all other classes is Any. It is similar to the Object class in Java and provides basic methods such as equals(), hashCode() and toString().

Example:

fun main() {
    val obj: Any = "Example"
    println(obj.toString())  // Will output: Example
}

All classes in Kotlin implicitly inherit from Any unless explicitly specified otherwise.