Why do we use “companion object” as a kind of replacement for Java static fields in Kotlin?
What is the intended meaning of “companion object”? Why is it called “companion”? First, Kotlin doesn’t use the Java concept of static members because Kotlin has its own concept of objects for describing properties and functions connected with singleton state, and Java static part of a class can be elegantly expressed in terms of singleton: … Read more