Examveda

What is the output of the following code?
val list : List<Int> = listof(1, 2, 3)
list.add(4)
print(list)

A. It does not compile, as listof is not known

B. [5, 6, 7]

C. It does not compile as List has no add method

D. [1, 2, 3, 4]

Answer: Option C


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.