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 O’Reilly online learning.

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