In Java, we can write in below way
In Java, we can write in below way class MyClass { public static int myMethod() { return 1; } } In Kotlin, we can write in below way In Kotlin, we can write in below way
class MyClass { companion object { fun myMethod() : Int = 1 } } a companion is used as static in Kotlin. a companion is used as static in Kotlin.