Kotlin - Null Safety
What is the output of this Kotlin code?
val user: String? = null println(user?.length ?: "No length")
val user: String? = null println(user?.length ?: "No length")
user is null, so user?.length returns null safely.?: returns "No length" because the left side is null.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions