Object Oriented Programming is uesd to design a program using classes and objects.It includes
- Object
- Class
- Inheritance
- Polymorphism
- Abstraction
- Encapsulation
Object:
An object is an entity that has state and behaviour.It can be physical and logical.
Class:
The Class is the collection of objects.It can be logical.
Inheritance:
When the chid object aquires all the behaviours and properties of parent object,called as Inheritance.
It is used to achieve runtime polymorphism.
Polymorphism:
When one task is performed by other ways,it is called Polymorphism.
In java, we use method overloading and method overriding to achieve polymorphism.
Abstraction:
Abstraction is hiding the internal details and showing only the essential functionality to the user.
In java, we use abstract class and interface to achieve Abstraction.
Encapsulation:
Binding of code and data together is called Encapsulation.
A java class is the example of encapsulation.