Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlinplatform types mechanicsSingle-choice MCQ

Given the code below, what is printed and why, considering how Kotlin checks nullability across the Java/platform-type boundary?

// Java: // class Box { public static String maybe() { return null; } } fun main() { val x = Box.maybe() // inferred type? println(x?.length ?: -1) }