Object Oriented Language

Object Oriented Language:
Java is an Object Oriented Language.
If you want to know how,
Then you should know first know what Object Oriented is?

Object Oriented Means
– Everything you work with in Object Oriented Language is an object.

What is Object?
In Real life #Conceptually, Object is real world entity, anything that has State and Behaviour can be called as an Object.
E.g. Bicycle, Dog, Vehicle etc.

Bicycle has state like current gear, current pedal, and current speed.
Bicycle has behaviour like changing gear, changing pedal and applying breaks.
Similarly The Software Object has States and Behaviours.

States are variable like
int current_gear;
int current_pedal;
float current_speed;

Behaviour are Methods/Functions like  
int changeGear() {
/*
Some statements
*/
}
void applyBreak(){
/*
Some statements
*/

}

#Imp:  Java is not Purely Object Oriented language.

Yes, Java is not Purely Object Oriented Language because, Object Oriented means only Objects nothing else. Object are made-up of class and methods.

But In Java we have Primitive Variable Like int, float , String , boolean ,double etc. They are not Object,

You May be thinking you all are able to use these Primitive Variable freely without any problem but that is because of Auto-Boxing and Auto-Unboxing.

No comments:

Post a Comment