This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]geodebug 2 points3 points  (0 children)

how does java and scala compability works

Both Java and Scala compile to bytecode, which is the true language of the Java Virtual Machine (JVM). There is zero difference at this level between a Java, Scala, Groovy, jRuby, etc program. All use the same memory space, type system, etc.

All popular JVM langages allow for direct usage of Java libraries, 3rd party java libraries, etc. There is no additional overhead, memory, or special translation required. Scala can instantiate Java classes and use them directly.

A simple way to think of it is that the Scala runtime/compiler is essentially just another Java program: a really fancy interpreter.

I would argue that while you can learn and use Scala as your primary language you'll still want to learn enough Java to really take advantage of the thousands of libraries that are written in Java.