Java: From Basics to Expert
Four levels, twelve lessons, every example compiled and run on a real JDK
Java is the language of large, long-lived systems: banks, insurers, telecoms, Android, and most of the data infrastructure the rest of the industry runs on. Code written twenty years ago still compiles, which is both why it is everywhere and why it has a reputation for verbosity.
Overview
What has not changed is the thing worth learning it for: the JVM. A platform that compiles the hot paths of a running program to native code, manages memory well enough that most developers never think about it, and runs the same artefact everywhere is a serious piece of engineering, and understanding it makes you better at the languages on top of it.
Introduction
No Java is assumed, and the course is taught on Java 21 rather than the Java most tutorials still teach. If you learned Java a decade ago, that is the reason to read it: records, sealed types, switch expressions, pattern matching and virtual threads have changed what ordinary code looks like.
Each level is three lessons and a Level Check quiz, with an Expert Exam at the end. There is no in-browser Java runner on the site yet, so every example was compiled with javac -Xlint:all and run on a real JDK before publication, and each one is a single file you can run with one command: java Example.java, once a JDK from adoptium.net is installed.
Every example in this course was compiled with javac -Xlint:all and run on a real JDK before publication. There is no in-browser Java runner yet, so the code blocks are for reading and for pasting into your own editor - install a JDK from adoptium.net and run each one with a single command: java Example.java.
By the end you will be able to write Java that a reviewer will pass without argument: immutable value objects as records, generics with the wildcards in the right places, streams that stay readable, concurrency that does not rely on hope, and a sense of where the time and the garbage actually come from.
What you will be able to do
- Explain what a variable holds, and why == is not equals
- Make invalid objects impossible with final fields and a validating constructor
- Use records, sealed types and exhaustive switch so a missed case will not compile
- Read a stream pipeline, and know when it has not run yet
- Say what a data race costs, and what virtual threads do and do not change
- Find a leak by asking what is still reachable
What each level covers
4 levels · 16 lessons
-
Level 1 - Basic
The split that explains most of Java's surprises: primitives are values, everything else is a reference, which is why == is not equals and why null arrives unannounced. Then control flow and methods, including switch as an expression that returns a value; then the collections framework, and which implementation to pick when it matters.
4 lessons 43 min of reading
Start with Values, Types and References → -
Level 2 - Intermediate
Designing with types. Records give you a value object in one line, with the validation that makes an invalid instance impossible; interfaces and generics cover erasure and the wildcards people guess at; sealed types let you say exactly which implementations exist; and the last lesson is failure - checked, unchecked and Optional, each used for what it is for.
4 lessons 49 min of reading
Start with Classes, Records and Value Objects → -
Level 3 - Advanced
The three things modern Java is written with. Lambdas, streams and collectors, with a clear line between where a stream is clearer and where a loop is; threads, executors and the virtual threads that change the arithmetic of blocking code; and pattern matching over sealed hierarchies, which turns a missed case into a compile error instead of a bug.
4 lessons 52 min of reading
Start with Lambdas, Streams and Collectors → -
Level 4 - Expert
What the runtime is doing underneath. Reachability and the garbage collector, and the leaks a collector cannot prevent; where the time goes, measured with the tools rather than guessed at from the code; and arranging an application in packages so that a change stays small and the dependencies point one way.
4 lessons 59 min of reading
Start with Objects, Memory and the Garbage Collector →
Guides and articles
Longer reading about this subject, written alongside the course.
Before you start
- No prior Java
- Some experience of any programming language helps but is not required
Common questions
- What does the Java: From Basics to Expert course cover?
- It is 4 levels and 16 lessons: Level 1 - Basic; Level 2 - Intermediate; Level 3 - Advanced; Level 4 - Expert. Each level ends with a quiz, and the last one is an exam over the whole course.
- How long does it take?
- About 203 minutes of reading and exercises - roughly 3.4 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
- What do I need to know first?
- No prior Java. Some experience of any programming language helps but is not required.
- Is it free?
- Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
- What will I be able to do afterwards?
- Explain what a variable holds, and why == is not equals. Make invalid objects impossible with final fields and a validating constructor. Use records, sealed types and exhaustive switch so a missed case will not compile. Read a stream pipeline, and know when it has not run yet. Say what a data race costs, and what virtual threads do and do not change. Find a leak by asking what is still reachable.