https://kotlinlang.org logo
Title
a

Andy Jiang

03/11/2022, 11:51 PM
Hi, I'm new to Kotlin and I have a question about the code snippet from the official doc:
val a: Int = 100
val boxedA: Int? = a
val anotherBoxedA: Int? = a
val b: Int = 10000
val boxedB: Int? = b
val anotherBoxedB: Int? = b
println(boxedA === anotherBoxedA) // true
println(boxedB === anotherBoxedB) // false
a

Andy Jiang

03/11/2022, 11:59 PM
Oh, good to know that there is some underlying optimization by JVM
Thank you!