Scala Tutorial
Scala is a multi-paradigm programming language, originally 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.
Scala source code is compiled into Java bytecode, so it can run on the JVM and can call existing Java class libraries.
Who should read this tutorial?
This tutorial is for developers who want to learn the Scala programming language from scratch. Of course, this tutorial also goes in depth on some modules to help you better understand Scala's applications.
What you need to know before studying this tutorial
Before continuing with this tutorial, you should understand some basic computer programming terms. If you have studied the Java programming language, it will help you understand Scala programming more quickly.
Study Java Tutorial。
The first Scala program: Hello World
The following is a typical Hello World program written in Scala:
Example (HelloWorld.scala)
object
HelloWorld
{
def
main
(
args
:
Array
[
String
]
)
:
Unit
=
{
println
(
"Hello, world!"
)
}
}
Run Example »
Save the above code as a HelloWorld.scala file and run the above Scala program (you can also run it online directly):
$ scalac HelloWorld.scala // 把源码编译为字节码
$ scala HelloWorld // 把字节码放到虚拟机中解释运行
The output is:
Hello, world!
Related document recommendations
The following is a Scala Language Specification.pdf document that can be used as a learning reference: