From your first class to a service-level middle
A trail through modern Java. First the class, the main method and types that do not lie. Then objects, collections and exceptions. At the end, generics and the shape of a small HTTP handler, the kind a middle developer meets every week.
- You read other people's Java and tell a value, a reference, null and an exception apart
- You write classes with clean boundaries, collections and checks
- You understand how a small HTTP handler picks a status code and keeps the thread alive
Foundation
A class, a launch and a package: what a Java program is made of.
- The class and the entry point — Why a program is a class and not a free-standing script.
- Compiling and running — How javac differs from java, and where the .class file goes.
- Packages — Why package exists and why import is not copying code.
Types
Primitives, strings and wrappers: where the value is and where the reference is.
- Primitives — int, long, double, boolean, and why char is not a string.
- Strings — String is immutable, and == on it is almost always a mistake.
- Wrappers and null — Integer can be null, int cannot.
Control flow
Branches, loops and switch: the program chooses and repeats.
- Branches — if reads a boolean, not "something that looks like true".
- Loops — for, while, and where a loop has to end.
- Switch — The new switch is an expression; the old one falls through easily.
Objects
Fields, boundaries and short immutable types.
- Fields and the constructor — An object is assembled once, not patched from the outside.
- Encapsulation — The field is private, the behaviour is a method.
- Records — A short immutable data carrier.
Collections
Lists, maps and object equality.
- Lists — ArrayList keeps order and can grow.
- Maps — A key is found in constant time; order is not a promise.
- Equality — equals and hashCode live as a pair.
The service
Errors, generics and the shape of a response.
- Exceptions — A failure is an object, and you catch it narrowly.
- Generics — A list of strings is not a list of who knows what.
- The service response — The code and the short line the client will see.