Appendix A. Mixing Kotlin with Java

Kotlin was first created as a language running on the Java Virtual Machine (JVM). JetBrains then introduced Kotlin JS, a version of the language running on the JavaScript VM, as well as Kotlin/Native, a version compiling to native binaries that runs without any VM. The vast majority of Kotlin programs are, however, designed to run in the JVM environment.

Such programs take advantage of the Java standard library, meaning that you can call any method of this library from a Kotlin program. There’s no limit to this, although you should probably not call any of these methods without first verifying whether Kotlin offers a better solution. On the other hand, Java programs can use libraries developed in Kotlin, although ...

Get The Joy of Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.