5

Interoperability with Java

Synergy is better than my way or your way. It’s our way.

Stephen Covey

Interoperability has been one of Kotlin’s priorities from its inception. In this chapter, you’ll learn the ins and outs of mixing Kotlin and Java, how their language concepts map to each other, what happens under the hood in the Kotlin compiler to aid interoperability, and how you can write code that further facilitates it.

Using Java Code from Kotlin

Java code can be called from Kotlin in the way you would expect most of the time. In this section, we’ll explore the details and possible pitfalls, as well as how to write Kotlin-friendly Java code and how to improve your Java code to provide additional information for the Kotlin compiler, especially ...

Get Kotlin for Android App Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.