0% found this document useful (0 votes)
7 views3 pages

Java OOPs Interview Questions Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Java OOPs Interview Questions Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java OOPs Interview Questions

1. Encapsulation
Q1: Encapsulation ?
Ans: Data methods class bundle fields private public
getters/setters access .

Example:
class Student {
private String name;
public String getName() { return name; }
public void setName(String name) { [Link] = name; }
}

2. Inheritance
Q2: Inheritance ?
Ans: Parent class properties methods child class reuse .

Example:
class Animal {
void eat() { [Link]("Eating..."); }
}
class Dog extends Animal {
void bark() { [Link]("Barking..."); }
}

3. Polymorphism
Q3: Method Overloading vs Overriding?
- Overloading: Same name, different parameters (compile-time polymorphism)
- Overriding: Same signature in child class (runtime polymorphism)

Example:
Java OOPs Interview Questions

class Animal {
void sound() { [Link]("Animal sound"); }
}
class Dog extends Animal {
void sound() { [Link]("Dog barks"); }
}

4. Abstraction
Q4: Abstract class vs Interface?
- Abstract class: Concrete + abstract methods
- Interface: Java 8+ default methods possible

Example:
abstract class Shape {
abstract void draw();
}
class Circle extends Shape {
void draw() { [Link]("Drawing Circle"); }
}

5. Important Repeated Questions


- Difference between Class and Object
- Constructor vs Method
- final, finally, finalize
- Access Modifiers (public, private, protected)
- Why Java does not support multiple inheritance

6. Tips for Interview Preparation


- Theory core concepts clear
- Code practice examples run
- Common patterns design patterns
Java OOPs Interview Questions

- Mock interviews confidence

You might also like