https://kotlinlang.org logo
#random
Title
# random
u

Ugai

09/30/2022, 7:48 AM
in 1.7.10 with jdk 17.0.3
Copy code
fun main() {
    val v1 : Int = 0
    class t {
        val v1: Int =1
        fun f0() : Int {
            return v1
        }
    }
    
    val t0 = t()
    println(t0.f0())
}
I got 0. Is this correct? I suppose it to be 1.
s

Sam

09/30/2022, 7:51 AM
u

Ugai

09/30/2022, 7:55 AM
Thanks. I have just read the thread. I understand it.
3 Views