Quiz on Idioms and Anti-Patterns

Practice your learning outcomes and test your understanding of the material presented in this chapter by taking this quiz.

1

What is the output of the following code?

fun main() {
    val person = Person().apply {
        name = "Sean Connery"
        nickname = "Dr. Kotlin"
    }

    println(person.nickname)
}

class Person {
    lateinit var name: String
    lateinit var nickname: String
}
A)

Dr. Kotlin

B)

Sean Connery

C)

Person

D)

Nickname

Question 1 of 50 attempted

Get hands-on with 1200+ tech skills courses.