issue 117apr 27mmxxvi
est. 2017
Sun, 27 Apr 2026
vol. IX · no. 117
PapersAdda
placement intelligence, since 2017
640+ briefs · 24 campuses · by reservation
verified offers · sourced from r/developersIndia
razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1razorpay₹65.00 LPA· iit-d · sde-1google₹54.00 LPA· iiit-h · swe-imicrosoft₹49.50 LPA· iit-b · sdeatlassian₹38.00 LPA· nit-w · sde-1amazon₹44.20 LPA· bits-p · sde-1uber₹42.00 LPA· iit-kgp · sde-1

Java OOPs Interview Questions 2026: 32 Q&A With Code

15 min read
Interview Questions
Updated: 8 Jun 2026
Aditya Sharma
Aditya's Edit

PapersAdda 2026 Placement Cycle

By Aditya Sharma·Founder & Editor, PapersAdda

What changed in 2026 drives

Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.

What I'd actually study for this

  • 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
  • 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
  • 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
  • 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken

Where most candidates trip up

The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.

Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.

Last Updated: June 2026 | Level: Freshers to Mid-Level | Read Time: ~16 min

Object-oriented programming is the backbone of every Java technical round. Candidates report that OOP questions appear in almost every service-company interview (TCS, Infosys, Wipro, Accenture) and form the warm-up in product-company loops before the DSA grind begins. This guide collects 32 of the most repeated Java OOP questions, each with a full answer, runnable code, and the follow-up the interviewer usually asks next. Public preparation resources and the official Oracle Java documentation back the language behaviour shown here, confirm any version-specific detail on the official docs because behaviour can shift between Java releases.

Pair this with our Java Interview Questions 2026 master set and the Java Collections Interview Questions 2026 deep dive for full coverage.


Table of Contents

  1. Fundamentals (Q1 to Q10)
  2. Inheritance and Polymorphism (Q11 to Q20)
  3. Abstraction and Interfaces (Q21 to Q27)
  4. Advanced and Tricky (Q28 to Q32)
  5. Predict the Output
  6. Quick Revision Table
  7. Frequently Asked Questions

Fundamentals

Q1. What are the four pillars of OOP in Java? Easy


Q2. What is a class and what is an object? Easy

class Car {            // blueprint
    String model;
    void drive() { System.out.println(model + " driving"); }
}

Car c = new Car();     // object on the heap
c.model = "Nexon";
c.drive();             // Nexon driving

Q3. What is encapsulation and how do you achieve it in Java? Easy

class Account {
    private double balance;                 // hidden state

    public double getBalance() { return balance; }

    public void deposit(double amt) {
        if (amt > 0) balance += amt;        // validated write
    }
}

The interviewer's follow-up is usually "why not make the field public?" Answer: a public field cannot enforce invariants such as a non-negative balance, and you cannot change the internal representation later without breaking callers.


Q4. What is a constructor? Can it be private? Easy

class Logger {
    private static final Logger INSTANCE = new Logger();
    private Logger() {}                       // private constructor
    public static Logger get() { return INSTANCE; }
}

Q5. What is the difference between a default constructor and a parameterised constructor? Easy


Q6. What is the this keyword used for? Easy

class Point {
    int x, y;
    Point(int x, int y) { this.x = x; this.y = y; }  // field vs parameter
    Point(int x) { this(x, 0); }                      // constructor chaining
}

Q7. What is the difference between instance variables and static variables? Medium

class Counter {
    static int total = 0;   // shared
    int id;                 // per object
    Counter() { id = ++total; }
}

Q8. What is constructor overloading? Easy


Q9. Can a constructor be inherited? Medium


Q10. What is the order of execution: static block, instance block, constructor? Medium

class Demo {
    static { System.out.println("static block"); }
    { System.out.println("instance block"); }
    Demo() { System.out.println("constructor"); }
}
// new Demo(); twice prints:
// static block      (once)
// instance block / constructor   (each time)

Inheritance and Polymorphism

Q11. What is inheritance and what types does Java support? Easy


Q12. Why does Java not support multiple inheritance of classes? Medium


Q13. What is the difference between method overloading and method overriding? Medium

class A { void show() { System.out.println("A"); } }
class B extends A {
    @Override void show() { System.out.println("B"); }   // overriding
    void show(int n) { System.out.println("B " + n); }    // overloading
}
A ref = new B();
ref.show();        // B  (runtime dispatch)

Q14. What is dynamic method dispatch? Medium


Q15. What is the super keyword used for? Easy


Q16. Can you override a static method? Hard

class P { static void m() { System.out.println("P"); } }
class C extends P { static void m() { System.out.println("C"); } }
P ref = new C();
ref.m();          // P  (static = no runtime dispatch)

Q17. Can you override a private method? Medium


Q18. What happens if you override a method and change only the return type? Hard

class Shape {}
class Circle extends Shape {}
class A { Shape make() { return new Shape(); } }
class B extends A { @Override Circle make() { return new Circle(); } } // covariant, OK

Q19. What is the difference between IS-A and HAS-A relationships? Medium


Q20. What is upcasting and downcasting? Medium

Animal a = new Dog();          // upcast, implicit
if (a instanceof Dog d) {       // pattern match, Java 16+
    d.bark();                   // safe downcast
}

Abstraction and Interfaces

Q21. What is abstraction and how is it achieved in Java? Easy


Q22. What is the difference between an abstract class and an interface? Medium

AspectAbstract classInterface
InstantiationCannot be instantiatedCannot be instantiated
MethodsAbstract plus concreteAbstract, default, static, private (Java 9+)
FieldsAny, including mutable statepublic static final constants only
InheritanceA class extends oneA class implements many
ConstructorHas constructorsNo constructors
Use whenRelated classes share state and codeUnrelated classes share a capability

Q23. Can an interface have a constructor? Medium


Q24. What are default methods and why were they added? Medium

interface Greeter {
    String name();
    default void hello() { System.out.println("Hi " + name()); }
}

Q25. What happens with the diamond problem for default methods? Hard

interface A { default void run() { System.out.println("A"); } }
interface B { default void run() { System.out.println("B"); } }
class C implements A, B {
    @Override public void run() { A.super.run(); }   // explicit resolution
}

Q26. Can an abstract class have a constructor and a main method? Medium


Q27. What is a functional interface? Medium


Advanced and Tricky

Q28. What is the difference between association, aggregation, and composition? Hard


Q29. What is the Liskov Substitution Principle? Hard


Q30. Why are equals() and hashCode() always overridden together? Hard

record User(int id, String name) {}   // equals + hashCode auto-generated

Q31. What is the difference between shallow copy and deep copy? Hard


Q32. What is polymorphism's benefit in real design? Medium


Predict the Output

Snippet 1

class A {
    A() { System.out.println("A ctor"); print(); }
    void print() { System.out.println("A print"); }
}
class B extends A {
    int x = 10;
    @Override void print() { System.out.println("B print x=" + x); }
}
new B();

Output:

A ctor
B print x=0

Why: The superclass constructor runs before B's field initialiser. The overridden print() is dispatched to B, but x is still 0 because its initialiser has not executed yet. This partial-construction gotcha is a favourite advanced question.


Snippet 2

class Parent { static String who() { return "Parent"; } }
class Child extends Parent { static String who() { return "Child"; } }
Parent p = new Child();
System.out.println(p.who());

Output:

Parent

Why: Static methods are not polymorphic. p has static type Parent, so Parent.who() is bound at compile time regardless of the runtime object.


Snippet 3

class Box {
    int val = 5;
    Box add() { val++; return this; }
}
Box b = new Box();
System.out.println(b.add().add().add().val);

Output:

8

Why: Each add() returns this, enabling method chaining. val increments three times from 5 to 8. This pattern is the basis of fluent builders.


Quick Revision Table

ConceptOne-line takeaway
Overloading vs overridingCompile-time vs runtime resolution
Static method overrideNot possible, only hidden
Multiple inheritanceClasses no, interfaces yes
Abstract class vs interfaceShared state and code vs pure capability
equals + hashCodeAlways override together
Upcast vs downcastImplicit safe vs explicit risky
Composition vs inheritancePrefer HAS-A for flexibility

Frequently Asked Questions

Which OOP topic is asked most in Java interviews in 2026?

Candidates consistently report runtime versus compile-time polymorphism, the difference between abstract class and interface after Java 8 default methods, and why Java has no multiple inheritance of classes. Master those three and you cover most fresher OOP rounds.

Do I need to memorise the four pillars of OOP for Java rounds?

You need to explain each pillar with a Java example, not just name them. Interviewers usually follow up with code, for example asking you to show encapsulation with a private field plus a getter, or polymorphism with an overridden method.

Is method overloading runtime or compile-time in Java?

Overloading is resolved at compile time based on the static type of the arguments. Overriding is resolved at runtime based on the actual object. Mixing these up is the single most common OOP mistake candidates report.

How deep should my answer on inheritance go for a fresher round?

Cover the types Java supports, why multiple inheritance of classes is banned, and the IS-A versus HAS-A trade-off. If you can also state that composition is usually preferred over deep inheritance, you signal design maturity that most freshers miss.

Are records replacing the need to understand equals and hashCode?

Records generate equals, hashCode, and toString for you, but interviewers still ask you to explain the contract. Knowing why equal objects must share a hash code is what they are testing, the record is just a convenience.



Confirm any version-specific Java behaviour on the official Oracle documentation before your interview. This guide reflects candidate-reported question patterns and public preparation resources as of June 2026.

Methodology applied to this articlelast verified 8 Jun 2026
Sources used
Public exam-pattern documents, official recruiter pages, and verified candidate reports on r/developersIndia and LinkedIn.
Verification window
Page last edited 8 Jun 2026 by Aditya Sharma. Numbers and patterns sanity-checked against the most recent 2026 cycle drives we tracked.
What we did NOT do
  • No fabricated salary numbers or success rates. If we quote a range, it's sourced.
  • No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
  • No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
Verification policy: /editorial-standards/. Found something incorrect? Submit a correction - we respond within 48 hours.

Explore this topic cluster

More resources in Interview Questions

Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.

Paid contributor programme

Sat this this year? Share your story, earn ₹500.

First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story - with byline.

Submit your story →

Ready to practice?

Take a free timed mock test

Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.

Start Free Mock Test →

Related Articles

More from PapersAdda

Share this guide: