Scala is a multi-paradigm programming language, which is designed to integrate the features of object-oriented programming and functional programming.
Scala runs on the Java virtual machine and is compatible with existing Java programs.
The Scala source code is compiled into Java bytecode, so it can run on JVM and can call existing Java class libraries. This tutorial is for developers who want to learn the Scala programming language from scratch. Of course, this tutorial will also go deep into some modules to give you a better understanding of the application of Scala. Before continuing this tutorial, you should know some basic computer programming terms. If you have studied the Java programming language, it will help you understand Scala programming faster. Take the Java tutorial. The following are typical examples written in Scala Save the above code as The output is as follows: The following is a copy Scala language norm.pdf ,the document can be used as a reference for learning. 8.1.1. Who is suitable for this tutorial? #
8.1.2. Before you take this tutorial, you need to know #
8.1.3. The first Scala program: Hello World #
Hello
World
Program:Example(HelloWorld.scala) #
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, world!")
}
}
HelloWorld.scala
file, execute the above
scala
program (you can also execute it directly online):$scalac HelloWorld.scala//Compile the source code into bytecode
$scala HelloWorld//Put the bytecode into the virtual machine to explain and run it
Hello, world!
8.1.4. Related document recommendation #