Static Variable In Kotlin

[Solved] Static Variable In Kotlin | Kotlin - Code Explorer | yomemimo.com
Question : static variable in kotlin

Answered by : abdullah-0kvpuik7ilzv

 companion object { lateinit var myStaticStr: String } 

Source : | Last Update : Fri, 23 Jul 21

Question : kotlin static variable

Answered by : abdullah-0kvpuik7ilzv

class Test {
companion object { var mInteger: Int = 10 fun hello() = println("hello world !") }
}
fun main(args: Array<String>) { print(Test.mInteger) print(Test.hello())
}

Source : | Last Update : Tue, 31 Aug 21

Answers related to static variable in kotlin

Code Explorer Popular Question For Kotlin