Beginner Kotlin
Q11 / 100

How do you declare a primary constructor in Kotlin?

Correct! Well done.

Incorrect.

The correct answer is B) class Person(val name: String)

B

Correct Answer

class Person(val name: String)

Explanation

Kotlin allows declaring the primary constructor directly in the class header with optional val/var to create properties.

Progress
11/100