Quiz: Data Classes

Test your understanding of the concepts discussed in this chapter.

1

What is printed by the following code?

data class User(
   val name: String,
   val age: Int
)

fun main() {
   val user1 = User("John", 25)
   val user2 = user1.copy()
   println(user1 == user2)
}
A)

true

B)

false

C)

Compilation error

D)

Runtime error

Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.