Sobes.tech
Junior — Senior

Result of copying a data class in Kotlin

livecode

Task condition

Determine what text will be printed to the console after running the given program.

data class Cat(
    val age: Int = 20,
    val name: String = "Sam"
)

const val defaultCat: Cat = Cat()

fun main(args: Array<String>) {
    println(defaultCat.copy(age = 21))
}