One of the questions my reader often ask me is, shall I learn Scala? Does Scala has better future than Java, or why Java developer should. Scala is one of the new languages that is based on the Java Virtual Machine compatibility. It has a lot of similarities and differences as. In this Scala tutorial, you will learn what is the Scala programming language, who created Scala, and why you need the JVM to run Scala.
|Published:||15 February 2016|
|PDF File Size:||48.21 Mb|
|ePub File Size:||31.86 Mb|
If you are coming from another programming language like say.
NET runtime in that it provides the environment for you to write and run your code. If you have been developing in Java, then I'm scala language you can skip this explanation and move on to the next one: Why do you need the JDK for writing Scala applications?
As scala language result, it interoperates nicely with existing Java code and libraries.
Scala Tutorial - What is Scala programming language
Perhaps the diagram below provides scala language better answer to this question: In Step 1 of the diagram, as a developer, you will write your Scala code. However, say for example that the company you work for already has existing Java libraries that would perhaps take too much effort and resources to refactor in Scala.
In addition, you may be using other third party Java libraries that you obviously cannot change or may be using open source Java libraries. Fortunately, moving to Scala and taking advantage of its functional features does not mean that you need to start from scala language.
Scala (programming language) - Wikipedia
It works with your existing Java code stack! In Step 2 of the diagram, you will call the Java compiler namely javac to compile your Java code.
With regards to compiling your Scala code, you would use the Scala scala language namely scalac. In most cases, you scala language be using an Integrated Development Environment or IDE to help you easily write and compile your applications.
A shorter version of the "Hello World" Scala program is: Scala language in expressions for evaluation. Scala does not require semicolons to end statements.
Scala language types are capitalized: Int, Double, Boolean instead of int, double, boolean. Parameter and return types follow, as scala language Pascalrather than precede as in C.
Methods must be preceded by def. Local or class variables must be preceded by val indicates an immutable variable or var indicates a mutable variable. The return operator is unnecessary in a function although allowed ; the value of the last executed statement or expression is normally the function's value.
Instead of the Java cast operator Type foo, Scala uses foo. Instead of Java's import foo. Function or method scala language can also be called as just foo; method thread.