Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlinJava interop JvmStatic JvmNameSingle-choice MCQ

Two top-level functions in the same file would compile to a name-clashing JVM signature when called from Java, and the developer applies @JvmName. What problem does @JvmName solve here that overloading alone cannot?

// File: Utils.kt fun List<String>.sumLengths(): Int = sumOf { it.length } @JvmName("sumIntList") fun List<Int>.sumLengths(): Int = sum()