🐦 Kotlin
Beginner
What is the difference between == and === in Kotlin?
Answer
In Kotlin, == checks structural equality — it calls the equals() method. For data classes, this compares all declared properties. For example, two different User objects with the same properties would be equal with ==. === checks referential equality — it checks if two references point to the exact same object in memory. This is equivalent to Java's ==. For primitive types like Int, Kotlin compiles == to == in bytecode, but for object types it uses equals().