Kotlin - Null Safety
Identify the error in this Kotlin code snippet:
val obj: Any = 10 val str: String = obj as? String println(str)
Identify the error in this Kotlin code snippet:
val obj: Any = 10 val str: String = obj as? String println(str)
as? returns a nullable type, but str is declared non-nullable String.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions