1. Define : Any method/ val/ var inside object( keyword for Singleton) will act like static in java . If you want that object inside any class use companion, else its optional.
Remember the trick is : object i.e. singleton
object Foo{ fun sayFoo() = println("Foo") val bar ="bar" } 2.Usage :
Foo.sayFoo() println(Foo.bar) 3.Output :
Foo bar