This is the first post in a 29-part Java track. It gets you from nothing installed to a program you wrote and ran, tells you which Java version everything here assumes, and then hands you the map of the other 28 posts.
You do not need any programming experience. You do need about twenty minutes and a terminal.
Install a JDK
You need a JDK — a Java Development Kit. Not a JRE. The JRE only runs
Java programs; the JDK also contains the compiler that turns your text file into something runnable.
Every "how do I compile Java" question that ends in command not found is someone who
installed the wrong one.
The distribution barely matters. Eclipse Temurin and Amazon Corretto are both free, both fine, and both are the same OpenJDK underneath. Pick one and move on.
# macOS
brew install --cask temurin@21
# Ubuntu / Debian
sudo apt install openjdk-21-jdk
# Windows — download the .msi installer from adoptium.net
Check that it worked. Both commands must answer, and both must say 21:
java -version # the runtime
javac -version # the compiler — this is the one that proves you have a JDK
Your first program
Put this in a file called Hello.java. The file name is not a suggestion: a public
class must live in a file with exactly its own name, or the compiler refuses.
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, world");
}
}
Now compile it and run it:
javac Hello.java # produces Hello.class — bytecode
java Hello # runs it. Note: no .class, no .java. Just the class name.
That is the whole cycle, and it is worth understanding rather than memorising:
javac Hello.java— the compiler reads your source and producesHello.class, which is bytecode: instructions for the Java Virtual Machine, not for your CPU.java Hello— the JVM starts up, loads that bytecode, and executes it. This is the step that makes the same.classfile run on Windows, macOS and Linux without recompiling.
Since Java 11 you can skip the first step for a single file, which is handy while you are learning:
java Hello.java # compiles in memory and runs, no .class file left behind
An editor, once the novelty wears off
A terminal and any text editor is genuinely enough for the first few posts, and doing it that way
once is worth it — you see that javac and java are just programs, not
magic your IDE performs.
After that, use an IDE. IntelliJ IDEA Community Edition is free and what most Java shops use; VS Code with the Extension Pack for Java is lighter and fine. The reason is not comfort — it is that an IDE tells you about a mistake as you type it rather than thirty seconds later, and it makes the debugger in post 26 available instead of theoretical.
Which Java version this track uses
Every example in these 29 posts is written for Java 21, and every one of them is
compiled by a real javac before it is published — if a snippet is on this site, it
builds.
Java 21 is a Long-Term Support release, and it is the version most companies are actually running right now. Java 25 is newer and also LTS, and it is a fine choice for a brand-new project — but a tutorial that assumed it would be teaching you code your employer cannot compile.
Where Java 25 changed something you will genuinely notice, this track says so in a callout rather than pretending it does not exist. Here is the first one, and it is a big one for a beginner.
In Java 25, that Hello World shrinks to this — no class, no static,
no String[] args, no System.out:
void main() {
IO.println("Hello, world");
}
That is a real, final feature in 25, not a preview. It exists because the classic version asks a first-day beginner to accept four concepts — visibility, static, arrays, and streams — before printing a line. If you are on 25, use it for your own scratch files. This track still uses the classic form, because that is what you will meet in every existing codebase and every interview.
Major LTS releases, and what each one added
Java ships a release every six months, but only some are LTS — supported for years rather than months. Those are the ones companies run and the only ones worth tracking. This is the short version of the last decade:
| Version | Released | What it added that you will actually use |
|---|---|---|
| Java 8 | March 2014 | The release that changed how Java is written. Lambdas, the
Stream API, Optional, method references, default
methods on interfaces, and java.time to replace the broken old date classes. Still
running in a lot of production systems. |
| Java 11 | September 2018 | var for local variables, useful String methods at last
(isBlank, strip, lines, repeat), a built-in
HttpClient, and running a single .java file without compiling it first. |
| Java 17 | September 2021 | Records, sealed classes, switch expressions,
text blocks for multi-line strings, instanceof pattern matching, and
NullPointerExceptions that finally tell you which thing was null. |
| Java 21 | September 2023 | This track's baseline. Virtual threads — cheap enough to
create a million of them — pattern matching for switch, record patterns, and
sequenced collections (getFirst(), getLast(), reversed()). |
| Java 25 | September 2025 | The current LTS. Compact source files and instance main methods
(the Hello World above), the IO class for simple console input and output, module
import declarations, flexible constructor bodies, and scoped values. |
Two things to take from that table. First, Java 8 is the dividing line — code written before it and after it look like different languages, which is why so much online Java advice is stale. Second, you do not need to learn these in release order. You need to learn them in the order below.
The app the examples come from
Most snippets in this track are short and self-contained, because int count = 0; does
not need a business domain. But where a topic is better shown in real code — exception hierarchies,
records, BigDecimal, streams, file handling — the examples are lifted from a working
console banking application, and marked as such.
It is deliberately small: plain Java 21, no Maven, no Gradle, no database. It reads and writes CSV files and runs from a shell script. You can read the whole thing in an afternoon, which is the point — a framework would have hidden the language behind annotations.
bank-java-console/src/com/bank/
model/ Money, Account, User, Transaction, AccountType, TransactionType
service/ AuthService, BankService
error/ BankException + InsufficientFundsException, ValidationException, ...
store/ CsvTable, CsvStore, UserStore, AccountStore, TransactionStore
ui/ Console, BankMenu
Every snippet quoted from it is checked against the real file before this site publishes, and the app has its own test suite, so nothing here is code that only looks right.
How to read this track
29 posts, each one topic, each about six minutes. In order:
| Posts | Part | What you get out of it |
|---|---|---|
| 1–2 | Getting started | This post, then what Java and the JVM actually are. |
| 3–10 | The language | Variables, types, operators, strings, if,
loops, arrays, methods. The grammar. |
| 11–15 | Object orientation | Classes, the four OOP ideas, interfaces,
static and final, packages. How Java code is organised. |
| 16–18 | Everyday Java | Collections, exceptions, dates. What you touch in every single job. |
| 19–25 | Modern Java | Lambdas, streams, method references, Optional, records, sealed classes, CompletableFuture. Post-Java-8 style. |
| 26–29 | Working like a professional | Debugging, getting unstuck, best practices, and a snippets page you will come back to. |
Read 1 through 18 in order — each one leans on the one before. From 19 on you can jump around, though lambdas should come before streams.
If you already write Java and landed here from a search, skip to the post you need. Nothing in 19–29 assumes you read 3–10.
What to do next
Do not read all of this and then start coding. Type every example — not copy-paste, type it. The compiler errors you cause by mistyping are the fastest way to learn what the compiler is checking, and post 27 is entirely about reading those errors.
Next: Introduction to Java — what the language, the compiler and the virtual machine each actually are, and why "write once, run anywhere" is still the reason Java is everywhere.