Answers for "kotlin class constructor"

1

how to instantiate a class in kotlin

private var xyz = ClassXYZ()
Posted by: Guest on August-11-2020
1

kotlin class constructor

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

kotlin constructors

class Car(var 
  brand: String, var model: String, var year: Int)

fun main() {
  val c1 = Car("Ford", 
  "Mustang", 1969)
  val c2 = Car("BMW", 
  "X5", 1999)
  val c3 = Car("Tesla", 
  "Model S", 2020)
}
Posted by: Guest on September-09-2021

Browse Popular Code Answers by Language