0% found this document useful (0 votes)
2 views2 pages

OOPs Java Interview Preparation

The document provides an overview of Object-Oriented Programming (OOP) in Java, covering its definition, basic concepts, and the four pillars: encapsulation, inheritance, polymorphism, and abstraction. It also discusses constructors, interfaces, exception handling, keywords, access modifiers, and common interview questions related to OOP. Key distinctions between abstract classes and interfaces, as well as composition versus aggregation, are highlighted.

Uploaded by

abir46708
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)
2 views2 pages

OOPs Java Interview Preparation

The document provides an overview of Object-Oriented Programming (OOP) in Java, covering its definition, basic concepts, and the four pillars: encapsulation, inheritance, polymorphism, and abstraction. It also discusses constructors, interfaces, exception handling, keywords, access modifiers, and common interview questions related to OOP. Key distinctions between abstract classes and interfaces, as well as composition versus aggregation, are highlighted.

Uploaded by

abir46708
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
You are on page 1/ 2

Object-Oriented Programming (OOP) in Java - Interview Preparation

1. What is OOP (Object-Oriented Programming)?

Definition:
OOP is a programming paradigm based on the concept of 'objects', which can contain data (fields) and methods
(functions).

Main goal: Code reusability, modularity, abstraction, and encapsulation.

2. Basic Concepts of OOP

Class: A blueprint for creating objects.


Object: An instance of a class.

3. Four Pillars of OOP

Encapsulation: Wrapping data and methods into a single unit (class).


Inheritance: One class inherits the fields and methods of another.
Polymorphism: One interface, many implementations (overloading/overriding).
Abstraction: Hiding internal details and showing only functionality.

4. Constructor in Java

Types:
- Default Constructor
- Parameterized Constructor
- Copy Constructor (manually implemented in Java).

5. Interface in Java

Used to achieve full abstraction and multiple inheritance.

6. Abstract Class vs Interface

Differences in method body, inheritance, access modifiers, variables, etc.

7. Exception Handling

Handling run-time errors using try, catch, throw, throws, finally.


Types: Checked and Unchecked exceptions.

8. Keywords in Java (OOP Related)

final, finally, this, super, static, new, instanceof.

9. Static Keyword

Used for static variables and static methods.


Object-Oriented Programming (OOP) in Java - Interview Preparation

10. 'this' vs 'super' Keyword

'this' refers to current class object, 'super' refers to parent class.

11. Overloading vs Overriding

Overloading: Same method name, different parameters (compile-time).


Overriding: Same method, different class (run-time).

12. Access Modifiers

public, protected, default, private - define visibility scope.

13. Object Class Methods

Common methods: toString(), equals(), hashCode(), getClass(), clone(), finalize().

14. Wrapper Classes

Convert primitive types to objects: Autoboxing/Unboxing.

15. Inner Classes

Class inside another class.

16. Composition vs Aggregation

Aggregation: Weaker 'has-a' relationship.


Composition: Stronger 'has-a' relationship.

17. Interview Questions from OOPs

1. Difference between abstraction and encapsulation?


2. Can a class implement multiple interfaces?
3. Why no multiple inheritance with classes in Java?
4. Difference between final, finally, and finalize?
5. How does Java achieve runtime polymorphism?
6. Can we override static methods?
7. Default value of object reference?
8. What is constructor chaining?
9. Can interface have private methods?
10. Why use interface if we have abstract class?

You might also like