01 — classes & interfaces
Contracts by interface, behavior by class — the shape of enterprise code for decades.
interface Dockable {
void dock(String port);
}
class Ship implements Dockable {
public void dock(String port) { ... }
}§ 02 — Eras · 1995
write once, run anywhere — the enterprise’s lingua franca
Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Java lives today — each column scrolls on its own.
C++ was unsafe in practice and unportable in deployment. The JVM made garbage collection and portability platform promises.
Ceremony — the factory-abstract-singleton years — verbose types, and a runtime footprint that starts in megabytes.
Session one is the smallest program that still counts as speaking Java: what every tutorial prints first, in the dialect that mattered when the language arrived (1995).
public class Hello {
public static void main(String[] args) {
System.out.println("Hello, world");
}
}101First contact — hello world and 3 ideas that define how Java reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.
3 fragments, each naming a habit of mind in Java. Read the note, then the code — together they are the 101 in one sitting.
01 — classes & interfaces
Contracts by interface, behavior by class — the shape of enterprise code for decades.
interface Dockable {
void dock(String port);
}
class Ship implements Dockable {
public void dock(String port) { ... }
}02 — the JVM
The virtual machine: GC, JIT, portability — a platform that outlived its language’s fashions.
// compile once
javac Hello.java
// run anywhere the JVM lives
java Hello03 — generics & streams
Modern Java is functional-adjacent: lambdas and streams over the old ceremony.
int total = ships.stream()
.mapToInt(Ship::tons)
.sum();The 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Java distinctive at scale.
Type parameters are checked at compile time and erased at runtime — which is why you cannot ask a List what it holds without a cast.
List<String> names = new ArrayList<>();
names.add("Perch");
String first = names.get(0); // checked, not storedA stream is a lazy pipeline over data: filter, map, collect, with short-circuiting and parallelism for free.
int total = ships.stream()
.filter(s -> s.tons() > 20)
.mapToInt(Ship::tons)
.sum();Threads, executors, CompletableFuture and (since 21) virtual threads — and beneath them, the class loader, the JIT and the garbage collector.
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
scope.fork(() -> fetchCrew());
scope.join().throwIfFailed();
}The virtual machine: one binary, any machine — garbage collection and sandboxing as platform promises. Write once, run anywhere; eventually, run everywhere.
public class Hello {
public static void main(String[] args) {
System.out.println("ahoy");
}
}installbrew install openjdk
runjava fact.java
Banks, airlines, Android (via the JVM lineage), Hadoop/Kafka/Elasticsearch — the back office of the internet.