Kotlin - Operators and Expressions
What will be the output of this Kotlin code?
val x = "Kotlin" val y = "Kotlin" println(x == y) println(x === y)
val x = "Kotlin" val y = "Kotlin" println(x == y) println(x === y)
x and y are string literals with the same content. Kotlin interns string literals, so they point to the same object.== and === resultsx == y is true because content is the same. x === y is also true because both refer to the same interned string object.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions