singleton class in kotline code example
Example: Kotlin singleton
object MySingleton {
fun myMethod(): Int {
return 5
}
}
MySingleton.myMethod() // 5
object MySingleton {
fun myMethod(): Int {
return 5
}
}
MySingleton.myMethod() // 5