Classes and Objects
Design your own types: classes, objects, constructors, this, encapsulation, static, packages, equals/hashCode, records, enums and immutability.
Until now every program lived inside one main method and worked with numbers, strings and arrays. Real programs model things: a bank account, a parcel, a player, an order. A class lets you invent a new type for that thing, and an object is one real copy of it living in memory. This phase is where Java stops being a calculator and starts being a language for building systems.
You'll learn how objects are created and laid out on the heap, how constructors set them up safely, why fields are made private, what static really means, how packages organise code, and the equals/hashCode contract that every HashMap in the world depends on. Then you'll meet the modern tools that remove boilerplate: records (Java 16) and enums, and finish with immutable objects and what happens to an object when nothing points to it any more.
Every topic builds on Phase 3 (methods, arrays, pass-by-value, stack and heap). Phase 5 builds directly on this one with inheritance and polymorphism, and Phase 9 (collections) relies on the equals/hashCode rules you learn in Topic 4.8.