Answers for "classes and constructors in kotlin"

1

kotlin class constructor

class InitOrderDemo(name: String) {   
    init {
        println("First initializer block that prints ${name}")
    }
}
Posted by: Guest on July-12-2021
0

what is the use of secondary constructor in kotlin ?

Although secondary constructors are not that common in Kotlin. The most common use of secondary constructor comes up when you need to extend a class that provides multiple constructors that initialize the class in different ways.
Posted by: Guest on April-15-2022

Code answers related to "classes and constructors in kotlin"

Browse Popular Code Answers by Language