What is the difference between the declarations of COLOR and SIZE?
class Record{
companion object {
const val COLOR = "Red"
val SIZE = "Large"
}
}
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
Related Questions on Kotlin Program
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.
Which platform does Kotlin primarily target?
A. Python Bytecode
B. JavaScript
C. JVM (Java Virtual Machine) Bytecode
D. PHP

Join The Discussion