Quick Answer: OOPs Interview Questions for Freshers 2026
The top 40 OOPs interview questions asked in Java fresher interviews at TCS, Infosys, Accenture, Cognizant in 2026 cover six clusters: the four pillars (encapsulation, abstraction, inheritance, polymorphism), abstract class vs interface (when to use each), inheritance types and the diamond problem, polymorphism (compile-time vs runtime), method overloading vs overriding, and SOLID design principles. Most fresher interviews include 5-8 OOPs MCQs plus 1-2 live coding questions (design a class hierarchy, implement an interface, override a method correctly). Infosys InfyTQ and Accenture AASS add a system-design-flavored OOPs question (design a library system, design a parking lot). For the full Q&A collection with 25 curated Java questions (OOPs is a major section), see the TutorsBot Java Interview Questions hub.
Why OOPs Matters So Much in Fresher Interviews
OOPs is the single highest-weight topic in service-company fresher Java interviews because: (1) every Java program is built on OOP, so the language forces you to internalize the concepts early; (2) OOPs questions test design thinking, not just syntax; (3) the same concepts extend directly to Spring/Spring Boot, microservices, and design patterns - so OOPs mastery is a leading indicator of mid-level readiness; (4) every other cluster (Collections, Exception Handling, Multithreading) is built on OOPs foundations; and (5) the four pillars are testable in multiple formats - MCQ, live coding, scenario question, and design discussion. TCS NQT has 2-3 OOPs MCQs; Wipro NLTH has 1-2; Infosys InfyTQ has 3-4 plus a live coding question; Cognizant GenC has 4-6 plus a system design discussion.
The 6 Topic Clusters Asked Most Often
Cluster 1: The Four Pillars of OOP
The mandatory baseline. Expect at least one question per pillar in most interviews: (1) What is encapsulation (bundling data and methods, restricting direct access via access modifiers, protecting invariants)? (2) What is abstraction (hiding implementation details, exposing only essential features; achieved through abstract classes and interfaces)? (3) What is inheritance (a new class inherits from an existing class, reusing code and establishing IS-A)? (4) What is polymorphism (one interface, multiple forms; compile-time via overloading and runtime via overriding)? The classic four-pillars question with one-paragraph answer for each is a near-universal fresher question. Follow-up: can you give an example of each from a real Java program? Common answers: encapsulation (a BankAccount class with private balance and public deposit/withdraw methods that enforce balance checks); abstraction (a List interface hides the ArrayList vs LinkedList implementation); inheritance (a SavingsAccount IS-A Account); polymorphism (Animal a = new Dog(); a.makeSound() calls Dog's makeSound() at runtime).
Cluster 2: Abstract Class vs Interface
The most-tested single OOPs question. The complete answer covers state (abstract classes can have instance variables and constructors; interfaces have only public static final constants), method types (abstract classes can have any mix of abstract, concrete, static, and (since Java 8) default methods; interfaces have only abstract methods plus (since Java 8) default and static methods plus (since Java 9) private methods), inheritance (single for abstract class via extends; multiple for interface via implements), use cases (abstract classes for code reuse among closely related classes - template method, common state; interfaces for type contracts that unrelated classes implement - capability markers, service interfaces), and historical context (before Java 8, interfaces had no methods with bodies and the choice was clearer; after Java 8 default methods and Java 9 private methods, the choice is more nuanced). Modern best practice: prefer interfaces for type contracts, use abstract classes only when you need shared state or significant code reuse. Common follow-up: can a class implement two interfaces that have a default method with the same signature (no - must override; or use InterfaceName.super.method() to disambiguate)?
Cluster 3: Inheritance Types and the Diamond Problem
Asked by Infosys InfyTQ and Cognizant GenC. Questions: What are the types of inheritance (single, multilevel, hierarchical, multiple of type, hybrid)? Does Java support multiple inheritance of classes (no - only single class inheritance via extends, but multiple interface inheritance via implements)? What is the diamond problem (a class inherits from two classes that both inherit from a common superclass; ambiguity about which superclass method to use; C++ allows it, Java does not for classes but does for interfaces since Java 8 default methods)? How does Java resolve the diamond problem for interfaces (compiler error if class inherits conflicting defaults; class must override; InterfaceName.super.method() to call one of the parents)? What is the Liskov Substitution Principle (objects of a superclass should be replaceable with objects of a subclass without breaking the application; the classic Square-Rectangle violation)? Why prefer composition over inheritance (composition = HAS-A, inheritance = IS-A; composition is more flexible and less coupled; the design heuristic 'favor composition over inheritance')? Common live coding question: design a class hierarchy for a library management system (Book, Author, Member, Library, Loan - identify IS-A vs HAS-A relationships).
Cluster 4: Polymorphism (Compile-Time vs Runtime)
Asked at Cognizant GenC Next and product company interviews. Questions: What is compile-time polymorphism (static binding, method overloading - same method name with different parameter lists, resolved at compile time by argument types)? What is runtime polymorphism (dynamic binding, method overriding - subclass provides specific implementation, resolved at runtime by actual object type via dynamic dispatch)? What is the vtable / method table (the JVM maintains a vtable per class; method calls are resolved by looking up the table; this enables dynamic dispatch)? What is covariant return type (an overriding method can return a subtype of what the superclass method returned since Java 5; e.g., superclass Cloneable.clone() returns Object, override can return your specific type)? What is the difference between early binding and late binding (early = at compile time, late = at runtime; virtual method invocation in Java is late binding)? Practical question: write code demonstrating both compile-time and runtime polymorphism, then explain what is printed and why.
Cluster 5: Method Overloading vs Overriding
Asked at every level. Questions: What is overloading (same method name, different parameter lists in same class or subclass; resolved at compile time; return type alone is not sufficient to disambiguate)? What is overriding (subclass provides specific implementation of superclass method; same name, same parameter list, compatible return type; @Override annotation recommended)? Can you override a static method (no - static methods are hidden, not overridden; the superclass static method is called regardless of actual object type)? Can you override a private method (no - private methods are not visible to subclasses; what looks like overriding is actually a new method)? What is method hiding (when a subclass defines a static method with the same signature as a superclass static method, the subclass version hides the superclass version; resolved at compile time by reference type, not actual object type)? Can constructors be overridden (no - constructors are not inherited; subclasses define their own constructors and must call super() if needed)? Common scenario question: what does the following code print - involves static vs instance method calls through a reference variable.
Cluster 6: SOLID Design Principles
Asked heavily at Cognizant GenC Next, Infosys Power Programmer, and product companies. (1) Single Responsibility Principle (SRP) - a class should have only one reason to change. (2) Open/Closed Principle (OCP) - classes should be open for extension but closed for modification; add new behavior via inheritance or composition, not by changing existing tested code. (3) Liskov Substitution Principle (LSP) - objects of a superclass should be replaceable with objects of a subclass without breaking the application; the subclass must honor the superclass contract. (4) Interface Segregation Principle (ISP) - clients should not be forced to depend on interfaces they do not use; prefer many small focused interfaces over one fat interface (the I vs IUser-vs-IUserReader-IUserWriter distinction). (5) Dependency Inversion Principle (DIP) - high-level modules should not depend on low-level modules; both should depend on abstractions; in Java achieved through dependency injection. Practical question: refactor the given code to follow SOLID principles; explain which principle was violated and how your refactor fixes it.
Top 10 OOPs Coding Questions Asked in 2026
These are the live coding problems that came up most often in 2026 fresher OOPs interviews at TCS/Infosys/Accenture/Cognizant:
- Design a class hierarchy for a Bank Account system (SavingsAccount, CurrentAccount, FixedDepositAccount - identify IS-A, HAS-A, demonstrate polymorphism, encapsulation)
- Design a class hierarchy for a Library Management system (Book, Author, Member, Library, Loan - identify relationships, abstract classes vs interfaces)
- Design a class hierarchy for an E-commerce system (Product, Category, Order, Customer, Payment - polymorphism, abstract classes)
- Implement a Shape hierarchy with area() and perimeter() methods (abstract Shape, concrete Circle, Rectangle, Triangle - polymorphism, abstract methods)
- Implement a Payment interface with CreditCard, DebitCard, UPIPayment implementations (interface, polymorphism, encapsulation)
- Demonstrate method overloading (print methods with different parameter types - int, double, String, array)
- Demonstrate method overriding (Animal base class with sound() method, Dog, Cat, Cow subclasses overriding it)
- Demonstrate the difference between == and .equals() in a custom class (override equals and hashCode, show the difference)
- Implement an Immutable class (final class, final fields, no setters, defensive copies in constructor and getters)
- Refactor a class with too many responsibilities into multiple classes following SRP
For the full Java interview questions collection with 25 curated questions covering all of these patterns plus more, see the TutorsBot Java Interview Questions hub.
Common Fresher Pitfalls to Avoid
- Confusing overloading and overriding: Overloading is same method name with different parameter lists in the SAME class or subclass; overriding is the same method signature in SUBCLASS providing new implementation
- Forgetting @Override annotation: Without @Override, a typo in the method signature creates an overload, not an override - the superclass method is still called, leading to confusing bugs
- Treating interface methods as default behavior: Before Java 8, all interface methods were abstract; if you add a method to an interface and don't update all implementations, they break to compile error
- Inheritance abuse: Using inheritance for code reuse when composition would be more appropriate (e.g., a Car HAS-A Engine, not IS-A Engine)
- Public fields instead of getters/setters: Breaks encapsulation; allows external code to modify internal state without validation, breaking invariants
- Mutable objects in fields: A field of type List or Date should be defensively copied in the constructor and getter to prevent external modification of internal state
- Tight coupling: Class A directly instantiating Class B (instead of depending on an interface) makes testing and reuse hard; prefer dependency injection
- God classes: A class with hundreds of methods and dozens of fields; violates SRP; split by responsibility
How to Prepare in 30 Days
The strongest 30-day fresher OOPs interview preparation plan:
- Week 1 - Foundations: Work through the Oracle Java OOP tutorial (docs.oracle.com/javase/tutorial/java/concepts/), read Head First Design Patterns (the most beginner-friendly patterns book), practice explaining the four pillars with concrete examples
- Week 2 - Live coding: Build 5-6 small class hierarchies (BankAccount, Library, Shape, Employee, Vehicle), implement each in Java with proper encapsulation, inheritance, polymorphism, abstract classes vs interfaces
- Week 3 - SOLID principles: Refactor 3-5 of your existing small projects to follow SOLID; study the strategy pattern, observer pattern, factory pattern, repository pattern
- Week 4 - Mock interviews: Take 2-3 timed mock tests, review the Java Interview Questions hub OOPs section for the full Q&A collection, refine your answers to the top 10 scenario questions
For a structured, project-based path from OOPs fundamentals to backend developer roles, the TutorsBot Full Stack Development training covers OOP, design patterns, Spring Boot, and API development end-to-end.
Frequently Asked Questions
How many OOPs questions are asked in TCS NQT 2026?
TCS NQT 2026 typically includes 2-4 OOPs questions in the coding/technical section for Digital and Prime profiles. For Ninja profiles, the count is lower (1-2 MCQs). TCS Digital and TCS Prime add a live coding question asking you to design a class hierarchy.
Is OOPs enough to get placed in TCS/Wipro/Infosys?
OOPs alone is not enough - companies test a combination of OOPs (Java or C++), DSA (50-100 problems), SQL, and aptitude/reasoning. Strong OOPs mastery combined with Java collections, exception handling, and Spring Boot basics covers 70%+ of service-company fresher Java interview questions. Cognizant GenC Next and Infosys Power Programmer require deeper OOPs (SOLID, design patterns) than TCS NQT or Wipro NLTH.
What is the salary for OOPs-skilled freshers at these companies in 2026?
Salary bands for freshers with strong OOPs and Java skills in 2026: TCS Ninja ₹3.36 LPA, TCS Digital ₹7-8 LPA, TCS Prime ₹9-11 LPA. Wipro ₹3.5-5 LPA. Infosys (InfyTQ Power Programmer) ₹6.5-9.5 LPA, regular InfyTQ ₹3.6 LPA. Cognizant GenC ₹4.5-6 LPA, GenC Next ₹7-12 LPA. Accenture AASE ₹4.5-6 LPA, AASS ₹6-9 LPA. Capgemini ₹4-6 LPA. HCL ₹3.5-5.5 LPA. Product companies (Flipkart, Razorpay, PhonePe) pay 2-3x these bands for OOPs-fluent candidates who can also do DSA, system design, and Spring Boot.
What is the best resource for OOPs interview preparation?
The strongest resources are: the Oracle Java OOP tutorial (docs.oracle.com/javase/tutorial/java/concepts/ - covers everything precisely), Head First Design Patterns (the most beginner-friendly patterns book - uses Java examples), Effective Java by Joshua Bloch (the classic Java best-practices book - chapters on classes and interfaces, generics, enums, lambdas, streams, methods are essential), Refactoring Guru (refactoring.guru/design-patterns - visual explanations of all GoF patterns with code), Baeldung OOP articles (in-depth articles on specific Java topics), and the TutorsBot Java Interview Questions hub for curated 25 questions covering OOPs deeply. Combine the official documentation for correctness, Head First Design Patterns for visual understanding, Effective Java for industry best practices, and a curated interview question set for company-specific patterns.
Can I learn OOPs without learning a programming language first?
You can learn OOPs concepts (encapsulation, abstraction, inheritance, polymorphism) in any language - even pseudo-code. But to interview well, you need to express the concepts in a real language (Java, C++, Python, C#) with working code. The interview pattern is: explain the concept, then write code that demonstrates it. Java is the most common service-company language; Python is preferred for fresher data/ML roles; C++ is the language for embedded and system programming roles. Pick one language and learn OOPs deeply in it; the concepts transfer to other languages but the syntax does not.
Resources and Next Steps
The authoritative sources listed (Oracle Java OOP tutorial, Baeldung, GeeksforGeeks, Refactoring Guru, Effective Java) are the canonical references for OOPs fundamentals and design principles. For the full Java interview questions collection with 25 curated questions covering OOPs deeply plus Collections, Multithreading, Java 8, and Spring Boot, see the TutorsBot Java Interview Questions hub. For related interview prep, see our Java interview questions, Python interview questions, and DBMS interview questions guides.






