In Kotlin, the object keyword is the idiomatic way to create a Singleton.
object Database {
val name = "MainDB"
fun connect() { ... }
}
// Usage
Database.connect()
Under the hood, it compiles to a Java class with a static INSTANCE field.
Mark this when you can explain the answer in your own words.
Help fellow developers prepare for interviews
Sharing helps the Android community grow ๐