CHAPTER 9

image

Scala and Java Interoperability

One of the main design goals of Scala is running on a JVM and providing interoperability with Java. The need for Scala and Java interoperability arises when you want to use existing Java libraries or frameworks. Scala code is often used in tandem with large Java programs and frameworks. Even though integration with Java is easy for the most part, we encourage you to use pure Scala as much as possible. When you are working with the Java library or framework, first try to find something equivalent in Scala, and use Java if there’s no equivalent Scala library available.

Scala is compiled to Java bytecodes, ...

Get Beginning Scala, Second Edition 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.