Skip to main content

8 docs tagged with "oops"

View all tags

Abstraction

Hide complexity behind a clean contract — when to use abstract classes vs. interfaces, default methods, and the design forces that govern the choice.

Classes & Objects

Understand Java classes as blueprints and objects as runtime instances — fields, methods, constructors, and the `this` keyword.

Encapsulation

Hide internal state behind a controlled interface — access modifiers, getters/setters, and the art of designing immutable classes.

Inheritance

Extend classes with `extends`, override behavior with `@Override`, use `super` for parent delegation, and learn when inheritance causes more harm than good.

OOP Interview Questions

Consolidated interview Q&A for Java OOP covering beginner through advanced topics — classes, encapsulation, inheritance, polymorphism, abstraction, records, and sealed classes.

Polymorphism

Compile-time (overloading) vs. runtime (overriding) dispatch — how Java decides which method to call and why this is the foundation of flexible design.

Records (Java 16+)

Java's concise immutable data carrier — understand what records generate automatically, compact constructors, and when records replace traditional value classes.

Sealed Classes (Java 17+)

Restrict which classes can extend or implement a type — enabling exhaustive pattern matching and modeling closed, well-known type hierarchies safely.