How do I make a second constructor in Kotlin?

To do so you need to declare a secondary constructor using the constructor keyword . If you want to use some property inside the secondary constructor, then declare the property inside the class and use it in the secondary constructor. By doing so, the declared variable will not be accessed inside the init() block.

Sizin İçin Seçtik  Kotlin hangi dilde yazıldı?

Leave a Reply

Your email address will not be published. Required fields are marked *