title: Why would you use a Kotlin companion object rather than an initializer block for creation?
body: <p><a href="https://www.youtube.com/watch?v=HTGj9ZxfiSA" rel="nofollow noreferrer">#37 Kotlin Tutorial | Companion Object | Factory Pattern</a> says you can use a Kotlin companion object when creating a class when it is complicated.</p>
  
  <p><a href="https://i.stack.imgur.com/DLrpP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DLrpP.png" alt="Companion Object | Factory Pattern"></a></p>
  
  <p><a href="https://www.programiz.com/kotlin-programming/constructors" rel="nofollow noreferrer">Kotlin Primary Constructor and Initializer Blocks</a> shows how to use a Kotlin initializer block  in a class.</p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      val person1 = Person("joe", 25)
  }
  class Person(fName: String, personAge: Int) {
      val firstName: String
      var age: Int
      // initializer block
      init {
          firstName = fName.capitalize()
          age = personAge
          println("First Name = $firstName")
          println("Age = $age")
      }
  }
  </code></pre>
  
  <p>Why would you use the companion object to do this rather than the initializer block?</p>
  
  <p>Regarding this question, I have no interest in Java.</p>