why use a singleton in kotlin programming 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