The init block is an initializer block in Kotlin classes.
init blocks; they execute in the order they appear in the class body.class User(val name: String) {
val upperName: String
init {
println("Initializing User: $name")
upperName = name.uppercase()
}
}
Mark this when you can explain the answer in your own words.
Help fellow developers prepare for interviews
Sharing helps the Android community grow ๐