Skip to main content

Basics for Scalas

Basics covers the everyday building blocks of Scala 3: val and var, type inference, expressions that return values, methods, and classes, case classes, objects and traits. Traits are Scala's interfaces with optional implementation, and they, with classes, form the object-oriented half of the language.

Stage: Language · Part of the Scala roadmap · Last reviewed 19 November 2026

What to learn in Basics

Basics interview questions

What is the difference between a class and a case class in Scala?

A case class is meant for immutable data. The compiler generates equals, hashCode, toString, copy and an apply factory, and it works with pattern matching. A regular class has none of that unless you write it yourself.

How does a trait differ from a Java interface?

A trait can hold concrete methods and fields, not just signatures, and a class can mix in several traits. Linearisation decides which implementation wins when they overlap. Java interfaces gained default methods but traits remain more flexible.

Where Basics fits in the Scala roadmap

Basics belongs to the Language stage (intermediate level), which takes about 28 hours. Scala 3 essentials.

Back to the full Scala roadmap