Object-Oriented Programming (OOP) is a programming paradigm that organizes
software using objects. Objects contain both
data (attributes) and behaviour (methods).
Java is a fully object-oriented programming language that supports code
reusability, modularity, and security.
Main OOP Concepts
Class – A blueprint for creating objects.
Object – An instance of a class.
Encapsulation – Wrapping data and methods into one unit.
Inheritance – Acquiring properties from another class.
Polymorphism – One interface, many implementations.
Abstraction – Hiding implementation details and showing only essential features.
1. Class and Object
A class is the theoretical blueprint, while an object is a concrete instance created from that blueprint.
2. Encapsulation
Bundling data and methods together into a single unit (like a capsule) and keeping variables private to hide sensitive state.
3. Inheritance
The process where one class (child class) acquires the properties and behaviors of another class (parent class).
4. Polymorphism
"Many forms" – The ability of a single method name to perform different actions based on the object invoking it.
5. Abstraction
Showing only necessary details to the user while hiding complex implementation mechanics internally.