Answers for "how do you call the companion object in kotlin?"

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

Code answers related to "how do you call the companion object in kotlin?"

Browse Popular Code Answers by Language