Kotlin - Null Safety
Identify the error in this Kotlin code snippet:
val list: List= listOf(1, 2, null, 4)
val list: List= listOf(1, 2, null, 4)
List<Int>, which means elements cannot be null.nullnull value, which is not allowed for non-nullable types, causing a compilation error.null because Int is non-nullable. -> Option Bnull is allowed in ListlistOf syntax is wrong15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions