The Four Pillars — Define Each in One Sentence
Interviewers open here to check whether you can be precise under pressure. Memorise a one-line definition plus a concrete example for each.
- Encapsulation — bundling data and the methods that operate on it, and hiding internal state behind access modifiers (private fields + public getters).
- Abstraction — exposing only what a caller needs and hiding how it works (a `Car.drive()` method hides the engine logic).
- Inheritance — a child class reusing and extending a parent's behaviour (a `Dog` is-an `Animal`).
- Polymorphism — one interface, many implementations; the same call behaves differently by type (`shape.area()` for Circle vs Square).
Abstraction vs Encapsulation — The Classic Trap
These get confused constantly. The distinction: abstraction is about design (what to expose), encapsulation is about implementation (how to protect it).
- Abstraction solves the problem at the design level — deciding the interface a class shows the world.
- Encapsulation solves it at the implementation level — using access modifiers to guard the data.
- One-liner to say out loud: 'Abstraction hides complexity; encapsulation hides data.'
Overloading vs Overriding
Both are polymorphism, but at different times. This is a near-guaranteed question.
- Overloading (compile-time / static) — same method name, different parameter lists, resolved by the compiler.
- Overriding (run-time / dynamic) — a subclass redefines a parent method with the same signature, resolved at run time.
- Overloading is 'ad-hoc polymorphism'; overriding is 'subtype polymorphism' — using the terms signals depth.
Interface vs Abstract Class
Know when to pick each — this often becomes a design question in the second half of the round.
- Abstract class — can have state and both concrete and abstract methods; use for an 'is-a' relationship with shared code.
- Interface — a pure contract (historically no implementation); use to add a capability across unrelated classes.
- Rule of thumb: 'inherit from a class, implement an interface' — a class extends one, implements many.
SOLID — Enough to Sound Senior
You will not be asked to recite all five in depth as a fresher, but naming them and explaining one well is a strong signal.
- S — Single Responsibility: a class should have one reason to change.
- O — Open/Closed: open for extension, closed for modification.
- L — Liskov Substitution: a subtype must be usable wherever its base type is expected.
- I — Interface Segregation: many small interfaces beat one fat interface.
- D — Dependency Inversion: depend on abstractions, not concretions.
Common Interview Questions & Answers
Q1. What is the difference between abstraction and encapsulation?
Abstraction is a design concern — it decides which details to expose and which to hide behind a simple interface, so a caller uses `car.drive()` without knowing the engine internals. Encapsulation is an implementation concern — it bundles data with the methods that act on it and restricts direct access using modifiers like private, exposing controlled getters and setters. In short, abstraction hides complexity; encapsulation hides data.
Always give a one-line real example after the definition — it proves understanding rather than memorisation.
Q2. Explain method overloading vs method overriding.
Overloading means defining multiple methods with the same name but different parameter lists in the same class; it is resolved at compile time (static/ad-hoc polymorphism). Overriding means a subclass provides a new implementation for a method it inherited with the identical signature; it is resolved at run time (dynamic/subtype polymorphism) based on the actual object type.
Mention 'compile-time vs run-time' explicitly — interviewers listen for that phrase.
Q3. When would you use an interface over an abstract class?
Use an interface when you want to define a capability that unrelated classes can share without a common ancestor — for example, Comparable or Serializable. Use an abstract class when classes share both an 'is-a' relationship and common implementation code you want to reuse. A class can implement many interfaces but extend only one class, so interfaces are also the way around single inheritance.
If asked in Java 8+, note that interfaces can now have default methods, which narrows the gap.
Q4. What is polymorphism and why is it useful?
Polymorphism lets one interface represent many underlying forms, so calling `shape.area()` runs Circle's or Rectangle's logic depending on the actual object. It matters because it lets you write code against an abstraction and add new types later without changing the caller — the core of extensible, maintainable design.
Tie it to the Open/Closed Principle to sound one level deeper.
Q5. Can you achieve multiple inheritance in Java?
Not through classes — Java allows a class to extend only one class to avoid the diamond problem, where an ambiguous method could be inherited from two parents. You achieve the effect by implementing multiple interfaces, and since Java 8 you can even share behaviour through default methods, resolving conflicts explicitly when two defaults collide.
Naming 'the diamond problem' is the detail that lands this answer.
Common Mistakes to Avoid
Giving textbook definitions with no example — interviewers cannot tell memorisation from understanding
Confusing abstraction (design/what) with encapsulation (implementation/how)
Saying overloading is run-time — it is compile-time
Claiming Java supports multiple inheritance of classes
Reciting SOLID as an acronym without being able to explain a single principle
Expert Tips
For every concept, prepare a 5-word real example you can say instantly
Use the exact phrases 'compile-time vs run-time' and 'is-a vs has-a' — interviewers grade on vocabulary
If you blank, reason from first principles out loud; process is scored, not just the answer
Relate at least one answer to a project you built to move from theory to applied
Pre-Interview Checklist
6 itemsFrequently Asked Questions
Is OOPs asked for every software role?
For freshers and campus placements, almost always — it is the default screen for structured thinking. For senior roles it is assumed and folded into design questions instead of asked directly.
Which language should I answer OOPs questions in?
Use the language on your resume. Java and C++ examples are the most universally understood by interviewers, but Python or C# are fine if that is your strength.
How deep should a fresher go on SOLID?
Name all five and be able to explain Single Responsibility and Open/Closed with an example. Deeper coverage is a bonus, not an expectation.
Ready to ace your next interview?
Practice with SpeakWell AI. Upload your resume → get resume-based questions → practice with AI interviewers → improve communication → track progress → get instant AI feedback.