how to create singleton and synchronized class 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