title: Kotlin: Difference between object and companion object in a class
body: <p>What is the difference between an object and a companion object in a class in kotlin?</p>
  
  <p>Example:</p>
  
  <pre><code>class MyClass {
  
      object Holder {
          //something
      }
  
      companion object {
          //something
      }
  }
  </code></pre>
  
  <p>I already read that companion object shall be used, if the containing parameters/methods are closely related to its class.</p>
  
  <p>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.</p>
  
  <p>Is there maybe a difference in its "static" (I'm from the java side) lifecycle? </p>