Examveda

How can you retrieve the value of the property codeName without referring to it by name or destructuring?
data class Project(var codeName: String, var version: String)
fun main(){
  val proj = Project("Chilli Pepper", "2.1.0")
}

A. proj.0

B. proj[0]

C. proj[1]

D. proj.component1()

Answer: Option D


This Question Belongs to Computer Science >> Kotlin Program

Join The Discussion

Related Questions on Kotlin Program

What is Kotlin?

A. A new version of Java.

B. A JavaScript framework.

C. A statically-typed programming language for the JVM, Android, and browser.

D. A database management system.