Learn Java

Learn Java from scratch, and watch every line run.

A free, hands-on course for complete beginners. 81 short lessons take you from your first line of code to objects, collections, files, tests and a small web service.

Main.javaStep 1 of 14
1void main() {
2 int sum = 0;
3 for (int i = 1; i <= 3; i++) {
4 sum = sum + i;
5 }
6 IO.println("Total: " + sum);
7}
sumint0

Make a variable called sum and store 0 in it.

The lessons

81 lessons in 10 parts, about 73 hours in all. Each one has questions to check yourself, and builds on the one before.

Phase 1

First steps

Install Java, write your first program, and learn the building blocks every program uses: values, decisions, loops, arrays and lists.

0 of 9 done

Phase 2

Objects

Why programs are built from objects and how to design your own classes, then test them. Strings join here, because a String is an object too.

0 of 13 done

Phase 3

Abstraction and design

Abstract classes, interfaces, enums, records and sealed types for modelling a problem cleanly, plus the design habits that keep code easy to change.

0 of 9 done

Phase 4

Collections and algorithms

Lists, sets, maps, stacks and queues and how they work inside, with Big-O, searching, sorting and recursion for reasoning about speed.

0 of 12 done

Phase 5

Errors, files and the standard library

Reading input, handling what goes wrong, working with files, and the library classes for dates, money and patterns in text.

0 of 9 done

Phase 6

Functional and modern Java

Streams, Optional and the newer syntax that makes Java shorter and clearer, then a project that pulls the core course together.

0 of 6 done

Phase 7

Concurrency

Running work at the same time with threads, executors and virtual threads, and keeping shared data safe.

0 of 5 done

Phase 8

Tools of the trade

Git, Maven and Gradle, logging, packaging an app, and using AI assistants without giving up your own understanding.

0 of 5 done

Phase 9

Data and the web

Databases with SQL and JDBC, calling web APIs, building your own API with Spring Boot, and shipping it with Docker.

0 of 7 done

Elective

Desktop apps with JavaFX

An optional track: windows, controls and events with JavaFX, ending with a desktop app that keeps its data in a database.

0 of 6 done

Your progress is saved in this browser. To carry it to another one, save it to a file and load it there.

Alongside the course

Pages to come back to while you learn, or after.

Questions, answered

What people ask before they start.

Is this Java course really free?
Yes. All 81 lessons, the playground, the glossary and the cheat sheets are free to use, with nothing to sign up for.
Is it for complete beginners?
Yes. It assumes no programming experience at all. The first lesson starts with what a program is and how Java runs it, and each lesson builds only on the ones before it. If you already know Python or JavaScript, a side-by-side guide shows Java next to the language you know.
Do I need to install Java to start?
No. Every runnable example in the lessons runs in your browser, so you can start straight away. The first lesson also shows how to install the JDK for when you want to run Java on your own computer.
Which version of Java does it teach?
Java 25, the current long-term support release. The lessons teach the modern way to write Java first, including records, pattern matching, virtual threads and compact source files with void main().
How long does it take to finish?
About 73 hours for all 81 lessons. Each lesson takes between 35 and 90 minutes, including its questions, and they are grouped into 10 parts.
How is it different from other Java tutorials?
You can watch the code run. Every example has a Run button that steps through the program one line at a time and shows each variable, loop pass and array change as it happens, so you see what the code does instead of guessing.
What will I be able to build by the end?
Console programs, programs that read and write files, a small web API with Spring Boot that saves its data with JPA, and desktop apps with JavaFX. Along the way the course covers testing with JUnit, Git and GitHub, Maven and Gradle, and Docker.
Is my progress saved?
Yes, in your browser, with no account. Lessons you mark as done stay marked, and you can save your progress to a file and load it in another browser.