Loading…
december code / try / kotlin
No account needed. Answer, see why, move on.
Problem
What happens when this Kotlin program is compiled and run?
data class P(val x: Int, val y: Int) class Q(val x: Int, val y: Int) fun main() { println(P(1, 2) == P(1, 2)) println(Q(1, 2) == Q(1, 2)) }
true, then true
true, then false
false, then false
It does not compile: == needs an equals method
Nothing here is saved. Create a free account to keep your progress, take an assessment and get your readiness score.