3

I am quite aware that many threads have been devoted to this subject, but it seemed to me, that mixing Scala and Java isn't that obvious.

So my background and expectancies first:

I used to code in Groovy and mixing it with Java is as simple, as it gets. Java is valid Groovy code (almost always), and in Groovy you can even implement pure Java interfaces, so that these are then used by other pure Java code. Simple!

So my questions are:

  • Can the same be done in Scala (Java interface, Scala implementation, used by Java) ?
  • Will the compiled implementation require Scala library/runtime/jar (it's ca. 7MB...) ?

1 Answer 1

3
  1. Yes, they are both interchangable. Look here.
  2. Yes, to run Scala code you will need the JAR file. (Check the conclusion of this.) The size is a known issue among Scala developers. I remember hearing about a stripped down version of the library, but I don't know if that came into existence or not.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.