Chapter 5. Scala
Scala is a unique language. It has strong support for functional programming and is also a pure object-oriented programming (OOP) language at the same time. We will cover both OOP and functional programming in this chapter.
The Scala installation offers two ways of running Scala code. It offers an interactive shell where the code can be directly entered and run right away. This program can also be used to run Scala's source code directly, without manually compiling it first. Also, it offers scalac
, a traditional compiler that compiles Scala's source code to Java bytecode and generates files with the .class
extension. This chapter will only focus on the first method; the next chapter will cover the scalac
compiler.
Scala comes with its own Scala standard library. It complements the Java Class Library that is bundled with the Java Runtime Environment (JRE) and installed as part of the Java Development Kit (JDK). Scala's standard library contains classes that are optimized to...