Learn Java – all lessons
16 lessons from beginner to advanced, building on each other and with code examples.
Hello World, main & Running
Structure of a Java program, output and comments.
Variables & Data Types
Primitive types, String, var, conversion and typical number pitfalls.
Conditions, if & switch
Making decisions – including the modern switch expression.
Loops
for, for-each, while and do-while.
Methods
Reusable building blocks: parameters, return values, overloading, varargs.
Arrays, Lists, Maps & Sets
The most important data structures of the Collections Framework.
Strings, StringBuilder & Text Blocks
Processing and formatting text and writing multi-line text cleanly.
Classes, Inheritance & Interfaces
Object orientation: encapsulation, constructors, inheritance, abstract classes, interfaces.
Records & Enums
Immutable data classes without boilerplate and fixed sets of values.
Exceptions & Files
Catching errors, try-with-resources and reading and writing files with java.nio.
Lambdas & Streams
Declaratively filtering, transforming, grouping and summarizing data.
Optional & Generics
Handling null safely and writing type-safe, reusable classes and methods.
sealed, Pattern Matching & Record Patterns
Closed type hierarchies and expressive case distinctions checked by the compiler.
Concurrency & Virtual Threads
Threads, ExecutorService, CompletableFuture, atomics and virtual threads (Java 21).
JVM, Memory & Garbage Collection
How Java code runs, where objects live and typical reference pitfalls.
Build Tools, Modules & JUnit
Maven/Gradle, dependencies, JAR files and testing with JUnit 5.