Object-Oriented Programming
The four pillars, equals/hashCode, immutability, SOLID, GoF design patterns, and modern Java 25 OOP (records, sealed classes, pattern matching). About 30% of any senior Java interview.
01Four Pillars: Encapsulation, Inheritance, Polymorphism, Abstraction
JuniorNot started
Four Pillars: Encapsulation, Inheritance, Polymorphism, Abstraction
The conceptual foundation interviewers test in the first 5 minutes — definitions, code examples, and the real-world reason each pillar exists.
01Define each of the four pillars in one sentence, with a Java example.Junior02Why is encapsulation more than just "make fields private"?Mid03Difference between abstraction and encapsulation — they sound similar.Mid02Classes, Constructors & Initialization Order
MidNot started
Classes, Constructors & Initialization Order
How constructors chain, what `this()` and `super()` mean, and the precise order in which static fields, instance fields, blocks, and constructors execute.
01Walk through the full object initialization order — static and instance.Senior02When do you use `this(...)` vs `super(...)`? Can both appear in the same constructor?Junior03When does the compiler insert a default constructor? When does it not?Junior03Inheritance, super, and Method Overriding
MidNot started
Inheritance, super, and Method Overriding
How overriding actually works on the JVM — dispatch tables, the @Override contract, covariant returns, and the difference between overriding and hiding.
01Difference between method overriding (instance) and method hiding (static).Mid02What are the rules for a valid override (signature, return, throws, access)?Mid03What is a covariant return type? Show a concrete example.Mid04Abstract Classes vs Interfaces (Post Java 8)
MidNot started
Abstract Classes vs Interfaces (Post Java 8)
After default methods landed, the line blurred. Where it still matters: state, constructors, multiple inheritance, evolution.
01Compare abstract class vs interface — state, constructors, multiple inheritance, default methods, when to use.Mid02What is the diamond problem and how does Java resolve it for default methods?Senior03Difference between default methods and static methods on an interface.Mid05Polymorphism in Practice
MidNot started
Polymorphism in Practice
Dynamic dispatch, the difference between reference type and runtime type, and how to refactor `if/instanceof` chains into polymorphic code.
01How does dynamic dispatch work on the JVM (vtables / itables)?Senior02Difference between reference type and object type at compile time vs runtime.Mid03Why are static methods NOT polymorphic? Demo with a subclass.Mid06Access Modifiers & Encapsulation
JuniorNot started
Access Modifiers & Encapsulation
public/protected/package-private/private, how each interacts with inheritance and the module system, and why fields should almost never be public.
01Compare public / protected / package-private / private. Where can each be seen from?Junior02Difference between protected and package-private — which is wider?Mid03Can a subclass narrow the access level when overriding? Why or why not?Mid07equals, hashCode, toString — the Object Contract
MidNot started
equals, hashCode, toString — the Object Contract
The contract every Java dev must internalize and the inheritance trap that breaks symmetry. Overlaps with the Collections module but lives here too as core OOP.
01State the equals contract (all five properties).Mid02State the hashCode contract and the relationship with equals.Mid03Show the symmetric equals trap with `ColoredPoint extends Point`.Senior08Inner Classes — Static Nested, Inner, Local, Anonymous, Lambdas
MidNot started
Inner Classes — Static Nested, Inner, Local, Anonymous, Lambdas
Four kinds of inner classes, what each can capture, when to pick which, and how lambdas relate.
01List the four kinds of nested classes. How do they differ?Junior02Difference between a static nested class and an inner (non-static) class.Mid03Why must captured locals be effectively final?Mid09Immutability & Defensive Copying
MidNot started
Immutability & Defensive Copying
The recipe for a truly immutable class, why defensive copies are required at the boundary, and where records do (and don't) get it right.
01List the rules for a truly immutable class (Effective Java Item 17).Mid02Why do you need defensive copies in both the constructor AND the getter?Mid03Why isn't marking a field `final` enough to make a class immutable?Mid10Composition vs Inheritance
MidNot started
Composition vs Inheritance
"Favor composition" — the most-cited Effective Java item. When inheritance still belongs, and how to use forwarding to wrap instead of extend.
01Why does Effective Java say "favor composition over inheritance"?Mid02Show a forwarding wrapper class — the classic InstrumentedSet example.Mid03When is inheritance still the right choice?Mid11SOLID Principles
MidNot started
SOLID Principles
The five principles — definition, a one-line interview hook each, a violation example, and the refactor.
01Single Responsibility Principle — define it, then show a violation and a refactor.Mid02Open/Closed Principle — refactor a switch into polymorphism.Mid03Liskov Substitution Principle with the classic Rectangle/Square violation.Senior12Creational Design Patterns
MidNot started
Creational Design Patterns
Singleton, Factory Method, Abstract Factory, Builder, Prototype — what each solves and when not to use it.
01Singleton — show enum, Bill Pugh, and double-checked locking variants. Which to prefer?Mid02Factory Method vs Abstract Factory — when to use each?Mid03When is Builder the right choice over a telescoping constructor?Mid13Structural Design Patterns
MidNot started
Structural Design Patterns
Adapter, Decorator, Proxy, Facade, Composite — how each composes objects to add capability without inheritance.
01Adapter vs Decorator — both wrap. What's the difference?Mid02Implement a Decorator (e.g., a coffee priced by add-ons).Mid03Proxy — name three kinds (virtual, protection, remote) with a real example.Mid14Behavioral Design Patterns
MidNot started
Behavioral Design Patterns
Strategy, Observer, Template Method, Command, Iterator, State, Chain of Responsibility — how objects coordinate behavior.
01Strategy vs State — both swap behavior at runtime. What's the difference?Mid02Implement Strategy using a lambda — when is the classic interface still better?Mid03Observer — implement it, then name its three biggest pitfalls.Mid15Modern OOP — Records, Sealed Classes, Pattern Matching (Java 14–25)
MidNot started
Modern OOP — Records, Sealed Classes, Pattern Matching (Java 14–25)
Records as data carriers, sealed hierarchies for exhaustive `switch`, pattern matching for destructuring. The shape of post-Java-21 OOP.
01What does the compiler auto-generate for a record?Mid02What CAN'T you do with a record? Why?Mid03Sealed classes — what does `permits` give you that final + package-private can't?Senior16Low-Level Design Practice
SeniorNot started
Low-Level Design Practice
How to walk a 45-minute LLD round: requirements → use cases → class diagram → key classes → patterns → trade-offs.
01Walk through your LLD framework: what do you do in the first 5 minutes of a 45-minute round?Senior02Design a parking lot — requirements, classes, patterns.Senior03Design an elevator system — focus on the scheduling algorithm.Senior