In Scala and Kotlin, an object with the same name as a class, used to hold utility members for the class
In scala and kotlin, a companion object is an object
with the same fully qualified name as a class. Companion objects are used to hold utility members that apply to all instances of the class. These can include constants, factory-methods (apply
), and implicit-conversions. They provide a similar functionality as Java's static-members.