Pages

Saturday, November 5, 2022

OOPs.. Is Java a pure Object Oriented Language?

Object Oriented Programming

Object Oriented Programming or OOPs is a programming model which is based on the Objects. 

We probably have to talk about the Class before we talk about an Object. 

In simple, A class can be considered as a blueprint or template which defines attributes (or variables), members and/or functions containing the behavior of the class. A class doesn't hold or contain any data as is, an instance of the class is to be created to hold and/or process the data. 

An Object is an instance of the class, which by default contains the instance of the variables and/or members defined as part of the class. 

Any number of objects can be created from a class and each object occupies separate storage and contains different data. 

E.g.: Class is like a blueprint of a house. Object is a house constructed physically based on the blueprint. Any numbers of houses can be constructed with the same blueprint.  

Is Java a pure Object Oriented Language? 

We can say Java is a Object Oriented Language, Any functionality that is to be run needs to be defined in a class and corresponding methods/functions. 

There is one thing that we need to consider is the use of primitive data types which are not classes. Java classes/objects can directly access primitive data types making which is deviating from calling it as a Pure Object oriented language. 

There are 8 primitive data types (byte, boolean, char, short, int, float, long and double) in java. 

No comments:

Post a Comment

OOPs.. Is Java a pure Object Oriented Language?

Object Oriented Programming Object Oriented Programming or OOPs is a programming model which is based on the Objects.  We probably have to t...