Examveda

Both const and @JvmField create constants. What can const do that @JvmField cannot?
class Detail {
  companion object {
    const val COLOR = "Blue"
    @JvmField val SIZE = "Really Big"
  }
}

A. const is compatible with Java, but @JvmField is not

B. The compiler will inline const so it is faster and more memory efficient

C. Virtually any type can be used with const but not @JvmField

D. const can also be used with mutable types

Answer: Option B


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.