Examveda

What is the difference between the declarations of COLOR and SIZE?
class Record{
  companion object {
    const val COLOR = "Red"
    val SIZE = "Large"
  }
}

A. Since COLOR and SIZE are both immutable, they are identical internally

B. Both are immutable, but the use of the keyword const makes COLOR slower and less space efficient than SIZE

C. const makes COLOR faster, but not compatible with Java. Without const, SIZE is still compatible with Java

D. Both are immutable, but the use of the keyword const makes COLOR faster and more space efficient than SIZE

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.