fun testSame(){
val a:Int?=23
Log.v("tag","test a === a is "+(a===a))
val boxA:Int?=a
val annotherBoxA:Int?=a
Log.v("tag","boxA===annotherBoxA is "+(boxA===annotherBoxA)+" boxA==annotherBoxA is "+(boxA==annotherBoxA))
}
boxA===annotherBoxA 是true还是false呢?
http://www.runoob.com/kotlin/kotlin-basic-types.html教程上说
在 Kotlin 中,三个等号 === 表示比较对象地址,两个 == 表示比较两个值大小。
可实际测下来打印为:
boxA===annotherBoxA is true boxA==annotherBoxA is true
好奇怪,谁能解释下为啥子呢