create singleton in kotlin 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