Java Interop
Call Java from Kotlin and Kotlin from Java with null safety and SAM.
Calling Java from Kotlin
Kotlin on JVM can use existing Java classes directly. A Kotlin example with source code and sample output.
Calling Kotlin from Java
Kotlin classes compile to JVM bytecode callable from Java. A Kotlin example with source code and sample output.
Kotlin Static Methods in Java
Companion object functions can be exposed as static methods. A Kotlin example with source code and sample output.
Kotlin Properties in Java
Kotlin properties generate getter and setter methods for Java. A Kotlin example with source code and sample output.
Null Safety Java Interop in Kotlin
Java types are platform types in Kotlin with unknown nullability. A Kotlin example with source code and sample output.
Kotlin SAM Conversions in Kotlin
SAM conversion allows lambda where Java functional interface is expected. A Kotlin example with source code and sample output.