Object-oriented programming solves Part 0's two problems: rules that nobody enforces, and type-checking if chains copied everywhere.
Encapsulation is the ATM: the cash drawer is private, and the only buttons are methods that check every request, so an invariant
like "credits never go negative" is guarded in one place (Ch 1). Inheritance is the family recipe book: a subclass extends a parent,
gets its fields and methods for free, runs the parent's constructor first through super(...), and adds its own — an is-a relationship,
with one parent per class and Object at the root (Ch 2). A subclass can override an inherited method under the same title, marked
with @Override so the compiler catches mistakes — which is different from overloading, same name with different parameters, chosen at
compile time (Ch 3).
Polymorphism is the TV remote: Question q can point to any kind of question, and dynamic dispatch through each class's method
table runs the actual object's version — so one grading loop handles every question type, and a new type needs no changes anywhere else
(Ch 4). Abstraction comes in two forms: an abstract class is a half-filled form with shared state and code plus blanks each subclass
must complete (Ch 5), and an interface is a job description — a pure contract any class can sign, as many as it likes, with default
methods whose clashes must be resolved explicitly, which is how Java avoids the diamond problem (Ch 6). And because deep family trees
are fragile, you usually compose: a quiz has a timer and a proctor, and features combine by swapping parts (Ch 7).
Every object also honours the equals/hashCode contract — equal objects must land in the same hash bin — or hash sets and maps silently
lose them (Ch 8). Classes initialise in a fixed order and can be sealed shut with final (Ch 9); helper types nest inside others, preferably
static (Ch 10); fixed sets of values become enums (Ch 11); and immutable data becomes a one-line record with all the boilerplate
generated correctly (Ch 12).
Next, SOLID Principles turns these tools into five rules for designs that stay easy to change.