Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Scala 3  Module 1 – Start here: Scala 3.9 LTS on the JVM

What Scala 3 is and where it runs in 2026

What Scala 3 compiles to and where it runs, the Scala Next and Scala LTS release lines from 3.3 to 3.10, and how to read the versions behind a run.

  • Beginner
  • 10 minutes
  • Examples run with scala 3.9.0, Java 25.0.4.1 and Python 3.14.8
  • By MySmartCoPilot
Free lesson, Pro answers: 10 minutes
Free: the whole lesson. With a pass: the model answers to its 2 interview questions.

What you will learn

  • Describe where Scala 3 code runs, on the JVM, as JavaScript through Scala.js and as native programs
  • Explain the Scala Next and Scala LTS release lines and choose one for a new application or library
  • Apply the rule that decides which Scala versions can use code compiled with another version
  • Identify the Scala and JDK versions behind a recorded run from what it printed
What you’ll learn

What you will learn

  • Describe where Scala 3 code runs, on the JVM, as JavaScript through Scala.js and as native programs
  • Explain the Scala Next and Scala LTS release lines and choose one for a new application or library
  • Apply the rule that decides which Scala versions can use code compiled with another version
  • Identify the Scala and JDK versions behind a recorded run from what it printed
On this page

Scala 3 is a statically typed language that combines object-oriented and functional programming, and its main home is the Java Virtual Machine. When Scala 3.9.0 compiled the small program on this page, it wrote five files: three .class files that any JDK 17 or newer can run, and two .tasty files that keep Scala’s own view of the types. The same language also compiles to JavaScript and to native programs.

Scala ships on two release lines, and every version this track mentions, from 3.3 to 3.10, belongs to one of them. This lesson shows where Scala code runs, how to choose a version for an application or for a library, and how to read the versions behind each recorded run in this track.

Scala compiles to class files that any JDK 17 or newer runs

Here is a whole Scala 3 program. @main marks the method that starts it, and the method prints the version of the Scala library that runs it:

hello.scala: a whole program Scala · hello/hello.scala
// A whole Scala 3 program: @main makes the method hello the program's starting point.
@main def hello(): Unit =
  val version = scala.util.Properties.versionNumberString
  println(s"Hello from Scala $version")

The session below compiles it into a folder named classes, lists what the compiler wrote, and looks inside with javap, a tool that comes with every JDK: The Java Development Kit: a JVM together with the Java compiler and tools such as javap. Scala 3.8 and later need JDK 17 or newer to compile and run. More in “Install Scala 3.9, a JDK and an editor”. Each session in this track shows the commands after $ and what they printed. They run with --server=false, which starts a fresh compiler for each command instead of using a background compile server (the third lesson explains the difference), and on JDK 25 they leave out a few WARNING lines that the scala launcher prints about itself, which the next lesson shows and explains.

Compile hello.scala and look inside Python · compile_session.py
from session import run

# Compile hello.scala into the folder classes, list what the compiler wrote, then look inside with the JDK's javap.
run("""
cd hello
scala compile . --server=false -d classes
ls classes
javap -cp classes hello
javap -v -cp classes hello | grep "major version"
""")

Output

$ cd hello
$ scala compile . --server=false -d classes
$ ls classes
hello.class
hello.tasty
hello$package.class
hello$package.tasty
hello$package$.class
$ javap -cp classes hello
Compiled from "hello.scala"
public final class hello {
  public hello();
  public static void main(java.lang.String[]);
}
$ javap -v -cp classes hello | grep "major version"
  major version: 61

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 compile_session.py

The compiler wrote five files. The three .class files hold bytecode: The instructions in a .class file. They are written for the JVM rather than for a real processor, so one compiled file runs on Windows, macOS and Linux alike., the instruction set of the JVM: The Java Virtual Machine: the program that loads compiled class files and runs their bytecode on your computer's processor. Scala's main platform; every JDK includes one.: hello.class is the program’s starting point, and the two hello$package classes hold the file’s top-level definitions. javap shows that hello is an ordinary JVM class with the public static void main(java.lang.String[]) method that every Java program starts from, generated from the @main method. So a Scala program can call any Java library, and Java code can call Scala classes, because both end up as the same kind of class file.

The line major version: 61 is the class-file version of Java SE 17 in the JVM specification. A JVM runs class files up to its own version, so JDK 17, 21 and 25 all run this program, and an older JDK refuses it. That is why Scala 3.8 and later need JDK 17 or newer, to compile and to run.

The two .tasty files hold TASTy: The typed syntax trees that the Scala 3 compiler writes into .tasty files beside the .class files. Later compilers and tools read them to see the full Scala types of compiled code., the typed trees the compiler built while it checked the program. Bytecode loses part of the types: a List[Int] becomes a list of plain objects, and the JVM has no idea of a union type such as Int | String. TASTy keeps them all, so when another Scala project uses this code as a library, its compiler, and editors such as Metals, read the full Scala types from these files. Step through the same compile and watch which program reads which file:

Interactive · step by step What the compiler writes, and who reads it Step through one compile of hello.scala. Each step names a file the compiler wrote and the program that reads it.
What the compiler writes, and who reads it, step 6 of 6. Showing hello.scala, Scala 3.9.0 compiler, 3 .class files, 2 .tasty files, JDK 17 or newer (prints the greeting), The next Scala compiler. In focus: The next Scala compiler.hello.scalaone @main methodScala 3.9.0 compilerscala compile3 .class filesbytecode, version 612 .tasty filesthe full Scala typesJDK 17 or newerprints the greetingThe next Scala compilerand the editorfull types

The drawing shows the whole scene; its 6 steps are listed below.

Every step as text
  1. The source. hello.scala holds one method marked @main. It prints a greeting with the version of the Scala library that runs it.
  2. The compiler checks it. scala compile hands the file to the Scala 3.9.0 compiler. It checks every type first; only a program that passes is translated, and a mistake stops it here with an error.
  3. Bytecode for the JVM. It writes three class files of JVM bytecode: hello.class, the program's starting point with a static main method, and two hello$package classes for the file's top-level definitions.
  4. The types, kept in TASTy. It also writes two .tasty files. They keep the typed trees the compiler built, with the full Scala types that bytecode loses, such as the element type of a List or a union type.
  5. A JVM runs the bytecode. Class-file version 61 is Java SE 17. A JVM runs class files up to its own version, so JDK 17, 21 and 25 run hello, and JDK 11 refuses it.
  6. The next compiler reads TASTy. When another Scala project uses this code as a library, its compiler reads the .tasty files rather than the bytecode, and so does an editor such as Metals when it shows types and completions.

Key idea

The compiler turns Scala source into JVM bytecode in .class files, which any JDK 17 or newer runs, and keeps the full Scala types in .tasty files for the next compiler and the editor.

Checkpoint

Check: What the compiler writes

  1. Question 1 of 2 Another Scala project adds your compiled code as a library. Which files does its compiler read to learn the full Scala types?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: The .tasty files

    The compiler writes two kinds of files. The .class files hold bytecode for the JVM, and the .tasty files keep the full Scala types, which a later compiler, and an editor such as Metals, read when the code is used as a library.

  2. Question 2 of 2 javap reported major version: 61 for hello.class. A teammate tries to run the program with JDK 11. What happens?

    Choose one answer.

    A hint

    Class-file version 61 belongs to one Java SE release, and a JVM reads class files up to its own version.

    Show the answer: Question 2 of 2

    Answer: The JVM refuses to load the class, because JDK 11 reads class files only up to version 55

    Version 61 is the class-file version of Java SE 17. A JVM runs class files up to its own version, so JDK 17, 21 and 25 run hello, and JDK 11, which reads up to version 55, refuses it. That is why Scala 3.8 and later need JDK 17 or newer.

The same code can also become JavaScript or a native program

The JVM is the main platform and the one this track uses, but two other projects compile the same language for other places. Scala.js turns Scala into JavaScript for browsers and Node.js, and Scala Native compiles it ahead of time, through LLVM, into a program that the operating system runs directly, with its own small runtime and no JVM:

Platform What the compiler produces, and what runs it A typical use
JVM (the default) .class and .tasty files, run by a JDK 17 or newer back-end services, data jobs, command-line tools
Scala.js 1.22 JavaScript, run by a browser or Node.js web front ends written in Scala
Scala Native 0.5 a native executable, run by the operating system small tools that must not need a JVM

On the JVM, Scala code can use every Java library. Apache Spark, the data-processing engine, is one example of Scala there: it offers a Scala API alongside Java, Python and R, and Spark 4.2.0 runs on Scala 2.13. Its documentation says that a Scala application must use the same Scala version that Spark was compiled for, which is why the Spark module of this track pins Scala 2.13 while every other module uses Scala 3.9.

Scala is a smaller language than Java or Python. In the 2025 Stack Overflow Developer Survey, 2.6 % of the 31,771 respondents to the question on programming languages chose Scala, and so did 2.8 % of the professional developers among them.

Learn the JVM version first

Learn and test on the JVM first, even for code that will also run as JavaScript or natively. Every library and tool of this track works there, and the same source can target the other platforms later.

Checkpoint

Check: JVM, Scala.js and Scala Native

  1. One question A team wants the price rules it wrote in Scala for its back end to run in the browser as well. Which compiler target fits?

    Choose one answer.

    Show the answer: One question

    Answer: Scala.js, which compiles Scala to JavaScript

    Scala.js compiles the same language to JavaScript for browsers and Node.js. The JVM stays the main platform for the back end, and Scala Native is for programs that run without a JVM.

Scala Next moves forward, Scala LTS stays put

Scala 3 is released on two lines. The official download page lists Scala Next: The release line of Scala 3 that receives new language features, in regular minor releases such as 3.10 after 3.9., currently 3.10.0, as “the default to be used by most users”, and Scala LTS: A long-term support line of Scala 3, such as 3.3 or 3.9. It receives only patch releases with fixes, for at least three years, and libraries are usually published with it., 3.9.0, as “advised to be used for publishing libraries”. Next is where the language develops: it receives regular minor releases, 3.8, 3.9 and 3.10, each with new features. An LTS line, in the words of the compatibility plan, “will only receive patch updates”: 3.9.1, 3.9.2 and so on, with fixes but no new features, for at least three years.

The project may name a new LTS line from the Next releases only after more than two years. 3.3 was the first, and 3.9 is the second. The Scala 3.9 announcement promises 3.9 at least three years of maintenance and keeps 3.3 LTS maintained for one more year after 3.9.0, with fewer fixes. Walk through the releases that shaped what a new project should use:

Timeline · 6 events in order Scala 3 releases that decide what a new project uses Walk through the releases in order. Each one changed which version, JDK or tool a new project should pick.
  1. 3.0

    Scala 3 is released new language

    The first release of Scala 3 came out in 2021, the third version of the language, with a new compiler and a cleaner syntax that makes braces optional.

  2. 3.3 LTS

    The first long-term support line LTS

    In 2023 the 3.3 series became the first LTS line of Scala 3. Its latest patch release is 3.3.8, and it stays maintained for one year after 3.9.0, with fewer fixes.

  3. 3.5

    Scala CLI becomes the scala command tooling

    From 2024 the scala command of the Scala distribution is Scala CLI, which compiles, runs, tests and packages code and opens the REPL, so a separate build tool is no longer needed to start.

  4. 3.8

    JDK 17 or newer is required JDK 17

    In 2026 the standard library began to be compiled with Scala 3, the REPL became a separate artifact with pretty-printed results, and compiling and running Scala now need JDK 17 or newer.

  5. 3.9 LTS

    The second long-term support line LTS

    3.9.0 opened the second LTS line in 2026, with at least three years of maintenance. It made the into modifier for implicit conversions stable, and this track's examples run on it.

  6. 3.10

    Scala Next moves on Next

    3.10.0 continued the Next line after 3.9. It turns old patterns into errors, such as the with type operator and this in top-level definitions, and lets the REPL load libraries with //> using dep.

The timeline has 6 events, from 3.0 to 3.10.

3.10 notes in this track

The lessons of this track run on 3.9.0. Where Scala 3.10 behaves differently, a note says so: 3.10.0 makes the with type operator an error, forbids this in top-level definitions and stops finding implicit values in companion objects that are not accessible, which 3.9 still finds and warns about under -deprecation.

Checkpoint

Check: Scala Next and Scala LTS

  1. Question 1 of 2 What does an LTS line such as 3.9 receive once it is released?

    Choose one answer.

    Show the answer: Question 1 of 2

    Answer: Patch releases with fixes, such as 3.9.1, for at least three years

    Scala Next receives new features in minor releases. An LTS line, first 3.3 and now 3.9, receives only patch releases with fixes, and each LTS line is supported for at least three years.

  2. Question 2 of 2 Which version does the download page describe as the default to be used by most users?

    Choose one answer.

    Show the answer: Question 2 of 2

    Answer: Scala Next, 3.10.0

    The download page lists two lines: Scala Next, 3.10.0, the default for most users, and Scala LTS, 3.9.0, advised for publishing libraries.

A newer Scala reads older output, never the other way round

Releases on one line are compatible in both directions: code compiled with 3.9.0 works with 3.9.2, and the other way round. Between minor versions only one direction works. The compatibility plan puts it as a rule: “Scala 3.b.y can consume the output of Scala 3.a.x only if b is greater or equal to a.”

Work it through for a library. Compiled with 3.3.8, it can be used by projects on 3.3, 3.9 and 3.10, because each of those minor versions is 3 or more. Compiled with 3.9.0, it reaches projects on 3.9 and 3.10, but a project still on 3.3 cannot read it, and the 3.9 announcement warns library authors of exactly that. Compiled with 3.10.0, it shuts out every 3.9 project too. An application has no such users, so it can take the newest version.

Answer the questions about your own project, and the table marks the versions that fit:

Interactive · answer and compare Which Scala version should a new project use? Answer the three questions about your project. The table marks the versions that fit, and the reason under each one that does not.
Will other projects add what you build as a library dependency?
Must projects that still build with Scala 3.3 be able to use it?
Must the compiled code run on a JDK older than 17?

Answer the questions above: the table then marks what fits your case and says why the rest does not.

Three Scala 3 versions against four things a new project needs to know
Version Newest language features Who can use what it compiles JDK the output needs How long it gets fixes
3.10.0 Release line: Scala Next: new features first Good gets them first, and also turns some old patterns into errors Poor only projects on 3.10 or newer Mixed JDK 17 or newer Mixed superseded by the next minor release, which you then move up to
3.9.0 Release line: Scala LTS: fixes for at least three years Mixed everything up to 3.9, nothing newer Good every project on 3.9 or newer, Scala Next included Mixed JDK 17 or newer Good patch releases for at least three years
3.3.8 Release line: the first LTS line, maintained one more year Poor nothing added from 3.4 to 3.10 Good every Scala 3 project from 3.3 on Good its output still runs on JDK 8 Poor maintained for one year after 3.9.0, with fewer fixes
How the answers decide
  • “Will other projects add what you build as a library dependency?” Yes, it is a library: rules out 3.10.0. Code compiled with 3.10 can be used only from 3.10 on, so a library built with it shuts out every project on 3.9 LTS.
  • “Will other projects add what you build as a library dependency?” No, it is an application or a service: adds a caveat to 3.3.8. An application has no users that compile against it, so it can take the newest line; 3.3 only adds a deadline to move up.
  • “Must projects that still build with Scala 3.3 be able to use it?” Yes, some of them are on 3.3: rules out 3.10.0 and 3.9.0. A 3.3 compiler cannot read the output of 3.4 or later, so only 3.3.8 reaches projects that still build with 3.3.
  • “Must the compiled code run on a JDK older than 17?” Yes, on JDK 8 or 11: rules out 3.10.0 and 3.9.0. From 3.8 on, Scala needs JDK 17 or newer to compile and to run; the 3.3 line still produces bytecode for JDK 8.

In short: an application can follow Scala Next, or stay on 3.9 LTS for fewer upgrades; a library is published with 3.9 LTS, or with 3.3.8 while its users still build with 3.3; and code that must still run on a JDK older than 17 stays on the 3.3 line, the only maintained line that still targets older JDKs, because from 3.8 on the compiler needs JDK 17.

Checkpoint

Check: Which versions can use which

  1. Question 1 of 2 A library is compiled with Scala 3.9.0. Which of these projects can use it? Choose every one.

    Choose every answer that is right.

    A hint

    Compare the minor versions. A project can read code from the same or an older minor version.

    Show the answer: Question 1 of 2

    Answer:

    • A project on 3.10.0
    • A project on 3.9.2
    • A project on 3.9.0

    Scala 3.b can consume the output of 3.a only if b is greater than or equal to a. A 3.9.0 library reaches 3.9.x and 3.10.x projects, but not 3.3 ones.

  2. Question 2 of 2 Your application moves to 3.10.0, and one of its libraries was compiled with 3.3.8 and is no longer updated. What happens?

    Choose one answer.

    Show the answer: Question 2 of 2

    Answer: It keeps working, because a 3.10 compiler reads code compiled with 3.3

    The rule is one-way: a newer minor version reads the output of the same or an older one. So moving an application to 3.10 keeps every 3.3 and 3.9 library usable, while a library compiled with 3.10 would shut out 3.9 and 3.3 users.

Every recorded run in this track names its versions

The programs of this track do not run in your browser. Each one shows what it printed when it ran with Scala 3.9.0 on Eclipse Temurin 25.0.4.1, under the command that ran it, so you can type the same command on your own computer and compare. This session prints the versions behind every run: first the scala command’s own report, then a program that asks the running JVM:

VersionReport.scala Scala · report/VersionReport.scala
// Reports what runs this program: the Scala library, the Java runtime and the platform.
@main def versionReport(): Unit =
  val scalaVersion = scala.util.Properties.versionNumberString
  val javaVersion = System.getProperty("java.version")
  val vendor = System.getProperty("java.vendor")
  println(s"Scala library   $scalaVersion")
  println(s"Java runtime    $javaVersion ($vendor)")
  println(s"Platform        ${System.getProperty("os.name")}, ${System.getProperty("os.arch")}")
The versions behind the recorded runs Python · report_session.py
from session import run

# The versions behind the recorded runs of this track: the scala command, then a program that reports what runs it.
run("""
scala version
cd report
scala run . --server=false
""")

Output

$ scala version
Scala code runner version: 1.16.0
Scala version (default): 3.9.0
$ cd report
$ scala run . --server=false
Scala library   3.9.0
Java runtime    25.0.4.1 (Eclipse Adoptium)
Platform        Mac OS X, aarch64

Recorded with Python 3.14.8 on macOS 26 arm64. To run it yourself: mise exec python@3.14.8 -- python3 report_session.py

Read the lines from the top. Scala code runner version: 1.16.0 is the version of the tool behind the scala command: since Scala 3.5 that command is Scala CLI, which compiles, runs, tests and packages code. Scala version (default): 3.9.0 is the compiler it uses when a project names no version. The program then reports the Scala library it found, 3.9.0, the Java runtime, Temurin 25.0.4.1 from the Eclipse Adoptium project, and the platform, macOS on an Arm processor (aarch64).

Two numbers can disagree on your computer, and both are worth knowing. The scala command may default to a newer Scala than the one a project asks for, and the JDK that runs your program may not be the first java on your PATH. The next lesson shows how each is chosen and how to pin them.

Checkpoint

Check: Reading the versions of a run

  1. One question scala version printed Scala code runner version: 1.16.0. What does 1.16.0 identify?

    Choose one answer.

    Show the answer: One question

    Answer: The version of Scala CLI, the tool behind the scala command

    The scala command is Scala CLI, here 1.16.0, and the line after it names the Scala version it compiles with when a project names none, here 3.9.0.

Practise: versions and platforms

Fifteen questions cover the five ideas above, from the files the compiler writes to the versions of a run. The session starts with whichever idea your answers show to be weakest, and each answer comes with its reason:

Practice that adapts to you

Practise this lesson

15 questions about 5 ideas of this lesson. Each answer is explained at once, and what you get right is kept in this browser.

  1. Question 1 of 15 Which Java SE release introduced class-file version 61, the version of hello.class?

    Choose one answer.

    Show the answer: Question 1 of 15

    Answer: Java SE 17

    Class-file version 61 is Java SE 17. Scala 3.8 and later compile for it, so their programs need a JDK 17 or newer.

  2. Question 2 of 15 javap -cp classes hello shows public static void main(java.lang.String[]). Where does that method come from?

    Choose one answer.

    Show the answer: Question 2 of 15

    Answer: The compiler generated it from the @main method

    The @main annotation tells the compiler to generate a class with the method's name and a standard public static void main(String[]) method, so the JVM can start the program like any Java program.

  3. Question 3 of 15 A library method returns List[Int]. In the compiled class file it returns a plain list of objects. Where does a Scala project that uses the library learn that the elements are Int?

    Choose one answer.

    Show the answer: Question 3 of 15

    Answer: In the library's .tasty files

    Bytecode erases type arguments, so List[Int] becomes a list of objects in the class file. The .tasty file keeps List[Int], and Scala compilers and editors read it.

  4. Question 4 of 15 What does Scala Native produce from Scala code?

    Choose one answer.

    Show the answer: Question 4 of 15

    Answer: A native executable, compiled ahead of time through LLVM, that runs without a JVM

    Scala Native compiles Scala ahead of time, through LLVM, into an executable with its own lightweight runtime, so it runs without a JVM.

  5. Question 5 of 15 A Scala.js program has been compiled. What can run it?

    Choose one answer.

    Show the answer: Question 5 of 15

    Answer: A browser or Node.js

    Scala.js compiles Scala into JavaScript for browsers and Node.js, so the result runs wherever JavaScript does.

  6. Question 6 of 15 A team writes Spark 4.2.0 jobs with Spark's Scala API. Which Scala version must the jobs use?

    Choose one answer.

    Show the answer: Question 6 of 15

    Answer: Scala 2.13, the version Spark 4.2.0 is compiled for

    Spark 4.2.0 runs on Scala 2.13, and its documentation says that applications using the Scala API must use the same Scala version that Spark was compiled for. That is why this track's Spark module pins 2.13.

  7. Question 7 of 15 For at least how many years does the compatibility plan promise to support each LTS line?

    Type a number.

    Show the answer: Question 7 of 15

    Answer: 3 years

    The compatibility plan promises every LTS line at least three years of support, and the 3.9 announcement makes the same promise for 3.9.

  8. Question 8 of 15 A bug is fixed in the 3.9 LTS line after 3.9.0. What is the version number of the release that carries the fix?

    Choose one answer.

    Show the answer: Question 8 of 15

    Answer: 3.9.1

    Fixes on an LTS line come as patch releases: 3.9.1, then 3.9.2 and so on. New features go to Scala Next instead.

  9. Question 9 of 15 Your services run on Scala 3.3.8. What does the Scala 3.9 announcement mean for them?

    Choose one answer.

    Show the answer: Question 9 of 15

    Answer: 3.3 stays maintained for one year after 3.9.0, with fewer fixes, so plan the move to 3.9

    With 3.9.0 the second LTS line began. The first one, 3.3, is maintained for one more year with fewer fixes, so 3.3 projects should plan to move to 3.9 LTS.

  10. Question 10 of 15 Complete the rule of the compatibility plan: Scala 3.b can consume the output of Scala 3.a only if …

    Choose one answer.

    Show the answer: Question 10 of 15

    Answer: b is greater than or equal to a

    Scala 3.b can consume the output of Scala 3.a only if b is greater than or equal to a. Patch versions within one minor line work both ways.

  11. Question 11 of 15 You publish the next release of a library compiled with 3.10.0 instead of 3.9.0. Who can no longer use it?

    Choose one answer.

    Show the answer: Question 11 of 15

    Answer: Projects on 3.9 and on 3.3

    Compiling a library with a newer minor version narrows who can use it: a 3.10.0 library is usable only from 3.10 on. That is why libraries are published with an LTS version.

  12. Question 12 of 15 A library you maintain must keep running on JDK 11 for one customer. Which Scala version can still build it?

    Choose one answer.

    Show the answer: Question 12 of 15

    Answer: 3.3.8, because the 3.3 line still produces bytecode for JDK 8

    The Scala 3.8 announcement makes JDK 17 the minimum for 3.8 and every later release, including 3.9 LTS, and says that 3.3 continues to produce JDK 8 compatible bytecode.

  13. Question 13 of 15 Which line of the recorded version report names the JDK that ran the program?

    Choose one answer.

    Show the answer: Question 13 of 15

    Answer: Java runtime 25.0.4.1 (Eclipse Adoptium)

    The report asks the running JVM for java.version and java.vendor, so its Java runtime line names the JDK that ran it: Temurin 25.0.4.1 from Eclipse Adoptium.

  14. Question 14 of 15 On a laptop, scala version prints Scala version (default): 3.10.0, but the version report of a project prints Scala library 3.9.0. How can both be true?

    Choose one answer.

    Show the answer: Question 14 of 15

    Answer: The project names 3.9.0 itself, and the default applies only to projects that name no version

    The scala command has a default Scala version for projects that name none, and a project can name its own. The next lesson shows how to pin 3.9.0 for a project.

  15. Question 15 of 15 Since which Scala release has the scala command of the distribution been Scala CLI?

    Choose one answer.

    Show the answer: Question 15 of 15

    Answer: Scala 3.5

    From Scala 3.5.0 the scala command is Scala CLI, which compiles, runs, tests and packages code. Scala 3.9.0 ships Scala CLI 1.16.0.

Interview questions

Fresher · What is the difference between Scala Next and Scala LTS, and which would you use for a new library?

Scala Next is the line where the language develops. It gets regular minor releases with new features, such as 3.8, 3.9 and 3.10, and each one supersedes the one before. Scala LTS is a long-term support line, first 3.3 and now 3.9: it gets only patch releases with fixes, for at least three years. The two matter most for libraries, because a Scala 3 minor version can use code compiled with the same or an older minor version, never a newer one. A library compiled with 3.10 can be used only from 3.10 on, while one compiled with 3.9 reaches every 3.9 and 3.10 project. So a new library is published with 3.9 LTS, or with 3.3.8 while important users still build with 3.3. An application has no downstream users, so it can follow Scala Next.

Model answers open with any pass: ₹79 for 1 week ($2.99), one payment that never renews.

  1. Mid to senior

    Your team maintains an internal library used by services on Scala 3.3.8 and on 3.9.0. A developer wants to publish the next release compiled with 3.10.0 to use a new language feature. What do you decide, and how do you roll it out?

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page. First step and follow-ups

  2. Mid to staff

    A company writes Spark 4.2 jobs and back-end services in Scala and wants one shared module of domain code. Why can't both sides simply use Scala 3.9, and how would you structure the shared module?

    Model answer, Pro. First step and follow-ups

Key takeaways

  • Scala 3 compiles to JVM bytecode in .class files, which any JDK 17 or newer runs, plus .tasty files that keep the full Scala types for later compilers and editors.
  • The JVM is Scala’s main platform, where it can use every Java library; Scala.js compiles the same language to JavaScript and Scala Native to native programs.
  • Scala Next, 3.10, receives new features in minor releases, while an LTS line, 3.3 and now 3.9, receives only fixes for at least three years.
  • A Scala 3 minor version can use code compiled by the same or an older one, never a newer one, so libraries are published with 3.9 LTS and applications may follow Scala Next.
  • The runs of this track used Scala 3.9.0, whose scala command is Scala CLI 1.16.0, on Temurin 25.0.4.1; the Spark module uses Scala 2.13, the version Spark is built for.

Terms in this lesson

bytecode
The instructions in a .class file. They are written for the JVM rather than for a real processor, so one compiled file runs on Windows, macOS and Linux alike.
JVM
The Java Virtual Machine: the program that loads compiled class files and runs their bytecode on your computer's processor. Scala's main platform; every JDK includes one.
Scala LTS
A long-term support line of Scala 3, such as 3.3 or 3.9. It receives only patch releases with fixes, for at least three years, and libraries are usually published with it.
Scala Next
The release line of Scala 3 that receives new language features, in regular minor releases such as 3.10 after 3.9.
TASTy
The typed syntax trees that the Scala 3 compiler writes into .tasty files beside the .class files. Later compilers and tools read them to see the full Scala types of compiled code.

References

Report a problem with this lesson

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.