Object
Oriented Programming Concept:
Object-Oriented
Programming is a methodology to design a program using.............
1.Object
2.Class
3.Inheritance
4.Polymorphism
5.Abstraction
6.Encapsulation
Object:
In real world there is
everything which we see has its state and behavior is called object. Such as
book, room, table etc.
Class:
Class is collection of
objects.
Inheritance:
It is just like parents and
child.
In real word, we know that child can access all the properties from parents.
In real word, we know that child can access all the properties from parents.
But parents can’t access
child’s properties.
This concept is basically called Inheritance. It provides code reusability.
This concept is basically called Inheritance. It provides code reusability.
Polymorphism:
Poly means many and morphos
means forms.
Polymorphism means many
forms or ways.
Java use method overloading
and method overriding to achieve polymorphism.
Abstraction:
Abstraction means hiding
internal activity and showing functionality.
For example: File save, we
just click save but we don't know the internal processing.
Java use abstract class and
interface to achieve abstraction.
Encapsulation:
Encapsulation means code and
data together into a single unit.
For example: capsule, it is
bonded with different medicines.
Class is the example of
encapsulation.
We all know that in a class
all the resource or code stay together.