OOP Interview Questions Every Fresher Should Know
Gokul
· 5 min read

Almost every fresher interview, whether for a service company or a product startup, includes a few object-oriented programming questions. They are rarely tricky. The interviewer wants to see whether you can explain a concept in plain words and back it up with a small example. This post covers the questions that repeat most, with short Java examples you can write on a whiteboard.
In short: know the four pillars (encapsulation, abstraction, inheritance, polymorphism), the difference between overloading and overriding, and when to choose an abstract class over an interface. These cover most OOP questions in placement interviews.
The Four Pillars at a Glance
Interviews usually open with “What is OOP?”. A good answer names the four pillars and gives one line on each. The sections below add a short example for every one.

Encapsulation: Keep Data Private
Encapsulation means bundling data and the methods that work on it inside one class, and restricting direct access to that data. The class decides how its own state can change.
class BankAccount {
private double balance;
public void deposit(double amount) {
if (amount > 0) balance += amount;
}
public double getBalance() {
return balance;
}
}Outside code cannot set balance to a negative number, because the only way to change it is deposit(), which checks the input first. The interview line: encapsulation is data hiding plus controlled access.
Abstraction: Hide the How
Abstraction means showing what an object does and hiding how it does it. A driver uses the steering wheel without knowing how the engine works. In Java, you get abstraction through abstract classes and interfaces.
abstract class Shape {
abstract double area();
}Shape promises that every shape has an area(), but leaves the formula to each subclass. You cannot create a Shape object directly.
Inheritance: Reuse and Extend
Inheritance lets a class reuse the fields and methods of another class. The child class extends the parent and adds or changes behaviour. It models an “is-a” relationship: a Circle is a Shape.
class Circle extends Shape {
double r;
Circle(double r) { this.r = r; }
double area() { return Math.PI * r * r; }
}
class Rectangle extends Shape {
double w, h;
Rectangle(double w, double h) { this.w = w; this.h = h; }
double area() { return w * h; }
}Both classes inherit from Shape and must provide their own area().
Polymorphism: One Call, Many Behaviours
Polymorphism means one interface with many behaviours. It comes in two kinds: compile-time polymorphism (method overloading) and runtime polymorphism (method overriding). The second one is the one interviewers care about most.
Shape[] shapes = { new Circle(2), new Rectangle(3, 4) };
for (Shape s : shapes) {
System.out.println(s.area());
}
// 12.566370614359172
// 12.0The loop calls area() on a Shape reference, but Java decides at runtime whether to run Circle's or Rectangle's version. That is runtime polymorphism.

Questions Interviewers Ask Most
Method overloading vs method overriding
Overloading: same method name, different parameters, in the same class. Resolved at compile time.
Overriding: a subclass redefines a parent method with the same signature. Resolved at runtime.
// Overloading: same name, different parameter types
int add(int a, int b) { return a + b; }
double add(double a, double b) { return a + b; }Abstract class vs interface
An abstract class can hold fields, constructors, and both implemented and abstract methods. A class can extend only one.
An interface defines a contract. A class can implement many interfaces. Since Java 8, interfaces can also have default methods.
Use an abstract class when subclasses share state or code. Use an interface when unrelated classes need to share a capability.
Abstraction vs encapsulation
Abstraction is a design idea: hide complexity and show only what is needed. Encapsulation is how you implement it at the code level: hide data using access modifiers such as private. They are related but not the same, and mixing them up is a common slip.
Why doesn't Java support multiple inheritance of classes?
If two parent classes define the same method, the child cannot tell which one to inherit. This is called the diamond problem. Java avoids it by allowing only one parent class, while still allowing a class to implement multiple interfaces.
What is a constructor?
A special method with the same name as the class and no return type. It runs when an object is created and initialises it. If you write none, Java provides a default no-argument constructor.
Can you override a static method?
No. Static methods belong to the class, not to an object, so they are not part of runtime polymorphism. Defining the same static method in a subclass hides the parent's method instead of overriding it.
Common Mistakes to Avoid
Reciting definitions without an example. Interviewers often follow up with “show me in code”.
Mixing up abstraction and encapsulation.
Saying “polymorphism” without naming which kind: compile-time (overloading) or runtime (overriding).
Using inheritance for every relationship. If the relationship is “has-a” rather than “is-a”, use a field (composition) instead.
Forgetting the access modifiers:
private, default,protectedandpublic.
Key Takeaways
The four pillars are encapsulation, abstraction, inheritance and polymorphism. Learn one line and one example for each.
Overloading is resolved at compile time. Overriding is resolved at runtime.
Abstract class for shared state and code, interface for a shared capability.
Java allows one parent class but many interfaces, which avoids the diamond problem.
Practice explaining each concept out loud with a small code example.
Test Your CS Fundamentals Under Time Pressure
Knowing a definition is different from recalling it cleanly in an interview or a timed test. Take a timed skill test on Skillrank to see how your core concepts hold up under real assessment conditions.