"Referential equality" Same Types, Different Result

Link Here (replay : yole)

Kotlin referential equality behavior on Int with values between -128 to 127 - Stack Overflow

Title : “Referential equality”

case #1

 var numA: Int = 100
 var numB: Int = 100
 println(numA === numB) // Result : true
 var numC: Int? = numA
 println(numC === numA) // Result : true

case #2

 var numA: Int = 1000
 var numB: Int = 1000
 println(numA === numB) // Result : true
 var numC: Int? = numA
 println(numC === numA) // Result : false

summary

1. println(numA === numB) : All Result is True
2. println(numC === numA) : Different Result
    *Interest things  -128 ~ 127 (is true)
                       another is false

Why is the result different?

1 Like

good, Thank’s i missed it
I will eliminate duplicate questions.