Answers for "companion object kotlin w"

11

companion object kotlin

class Test {
companion object {
        var mInteger: Int = 10
        fun hello() = println("hello world !")
    }
}

fun main(args: Array<String>) {
    print(Test.mInteger)
    print(Test.hello())
}
Posted by: Guest on August-24-2021

Browse Popular Code Answers by Language