Appendix A

Quick Preview of Java

Scala has many of its roots in the Java programming language beyond compiling to the Java Virtual Machine (JVM) and having the ability to call on Java library functions. For this reason, it should not be too hard to pick up Java after you have learned Scala. This appendix is designed to help you in doing exactly that. To accomplish that goal, we will run through a number of different simple examples of Java code and look at the ways in which they are different from Scala code. Given that you are already familiar with Eclipse, this will be done using that platform. Simply switch to the Java perspective, which is the default for Eclipse, make a project, and try things out.1

A.1 Hello World

We will start with Java ...

Get Introduction to the Art of Programming Using Scala 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.