Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
How Scala Works? | Getting Started
Introduction to Scala
course content

Conteúdo do Curso

Introduction to Scala

Introduction to Scala

1. Getting Started
2. Variables and Data Types
3. Conditional Statements and Loops
4. Arrays
5. Strings

bookHow Scala Works?

Understanding Compilation

Compilation process is similar to translating a book from one language to another. Imagine you've written a book in French, but you want everyone to understand it. To do this, you would translate your French book into a certain universal language that even a toddler understands.

In the world of computers, when you write a program, you write it in a programming language that humans understand, like Scala. However, computers don't understand these languages directly. They only understand their own special language, called machine code, which is very basic and consists of lots of 0s and 1s.

So, when you compile a program, you're basically turning your instructions into a form that the computer can follow to perform the tasks you've programmed it to do.

Compilation in Scala

Let’s now take a close look at the compilation process in Scala. When Scala code is compiled, the Scala compiler (scalac) checks the code for correctness and then converts it into Java bytecode stored in the .class files. provided that there are no errors.

This bytecode is designed to be executed by Java Virtual Machine (JVM) rather than directly by the hardware's processor. Consequently, it is not specific to any particular machine architecture, making it portable across different platforms that have a JVM implementation.

Running the Code

After compilation, the bytecode can be run on the JVM. Basically, the JVM executes this bytecode, which results in your Scala code being run.

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 2
some-alt