"Referential equality" Same Types, Different Result


#1

Link Here (replay : yole)

https://stackoverflow.com/questions/35621302/kotlin-referential-equality-behavior-on-int-with-values-between-128-to-127

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?


#2

#3

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