<Why calling a private constructor in Kotlin resul...
# stackoverflow
u
Why calling a private constructor in Kotlin results in error as "Cannot access &lt;init&gt;"? What is &lt;init&gt;? If you use factory method in Kotlin to create an object, like: class Person private constructor(val firstName:String , val lastName: String) { companion object { fun createPerson(firstName: String, lastName: String): Person { return Person(firstName, lastName) } } } Calling factory method works: val person1 = Person.createPerson("Niels", "Abel") And also, of course, you can't call the constructor directly: val person2 = Person("Évariste", "Galois") The...