Kotlin: Difference between object and companion object in a class
What is the difference between an object and a companion object in a class in kotlin? Example: class MyClass { object Holder { //something } companion object { //something } } I already read that companion object shall be used, if the containing parameters/methods are closely related to its class. But why is there also the possibility of declaring a normal object in the class? Because it behaves exactly like the companion, but it must have a name. Is there maybe a difference in its "static" (I'm from the java side) lifecycle? Objects can implement interfaces. Inside a class, defining a simple