Scala tutorial


Release date:2023-11-10 Update date:2023-11-10 Editor:admin View counts:132

Label:

Scala tutorial

Image0

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.

Who is suitable for this tutorial?

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 you take this tutorial, you need to know

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 first Scala program: Hello World

The following are typical examples written in Scala Hello World Program:

Example(HelloWorld.scala)

object HelloWorld {
    def main(args: Array[String]): Unit = {
        println("Hello, world!")
    }
}

Save the above code as 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

The output is as follows:

Hello, world!

Related document recommendation

The following is a copy Scala language norm.pdf,the document can be used as a reference for learning.

Powered by TorCMS (https://github.com/bukun/TorCMS).