01. Setting up Scala & practicing the concepts via REPL the Scala way for Java developers

Scala runs on the JVM, so Java and Scala stacks can be freely mixed. You can call Java libraries from Scala. Having said this, it is very important that you learn to write code the Scala way, and Not Java way. Currently, Java programmers with Scala experience are paid more and in demand.

Step 1: Download the latest version of Scala from “http://www.scala-lang.org/”. I downloaded scala-2.11.6 for windows 8 and installed it in “C:\development\scala-2.11.6” same location where my Java 8.

Step 2: Now, if you check your environment variable “path”, it should have “C:\development\scala-2.11.6\bin”. Open a DOS environment, and type

Step 3: Type “scala” on the command prompt to get the “REPL” shell, which stands for Read-Eval-Print-Loop.

:q” to quit the Scala shell. You can practice Scala on this REPL.

Step 4: Entering multi-line commands on REPL by starting with “:paste” and “ctrl+d

Step 5: In the above example, the number1 type was declared as an “Int”. In Scala the data types can be inferred as shown below.

So, REPL is a great way to learn the Scala core concepts to write code the Scala way with free online tutorials and YouTube videos. Search for “Scala tutorials for Java developers“. Learn the concepts like type inference, immutability, functional programming, expressions, pattern matching, case classes, partial function, Option type to prevent NullPointerExceptions, reactive programming, multiple parameter sets, etc.

I will focus more on industrial strength tutorials in Scala with Akka, Spark, reactive programming, etc that empowers you to target low latency and Big Data jobs.

300+ Java & Big Data Interview FAQs

16+ Java Key Areas Interview Q&As

800+ Java Interview Q&As

300+ Java & Big Data Tutorials