Java Object Oriented Programming (OOPs) Concepts

Java is an Object Oriented Programming language. There are many object oriented features in java such as Inheritance, Polymorphism, Abstraction, Encapsulation etc.

The first object-oriented programming language is Simula.
Java is known as truly object-oriented programming language because all java programs is written in class.


An object is real time entity. An object has state and behavior. For example: car, fan, bus etc. An object can be physical and logical.
An Object can be defined as an instance of a class.


A class is a blueprint or prototype of objects. A class is defined by an user. A class has variables and methods (functions).
A class is also known a user-defined data type, which has data members and member methods (functions).


Inheritance is an important concept of OOPs(Object Oriented Programming). If an object acquires all the properties and behaviours of its parent object i.e. known as inheritance. Inheritance is very important for code reusability.
The real life example of inheritance son and father, all the properties of father are inherited by his son.
Inheritance is used to achieve runtime polymorphism.


Polymorphism is the ability of an object to take on many forms. In other way, Polymorphism is an object-oriented programming concept that refers to the ability of a variable, function or object to take on multiple forms.
In java, we use method overloading and method overriding to achieve polymorphism.
Real life example of polymorphism: A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same person posses different behaviour in different situations.


Abstraction identifies only the required characteristics of an object ignoring the irrelevant details. Abstraction is showing only essential information and hiding certain details. In other way, Hiding internal details and showing functionality is known as abstraction.
For example: phone call, we don’t know the internal processing.
Another real life example of Abstraction is ATM Machine; All are performing operations on the ATM machine like cash withdrawal, money transfer, retrieve mini-statement…etc. but we can’t know internal details about ATM. Note: Data abstraction can be used to provide security for the data from the unauthorized methods.

In java, we use abstract class and interface to achieve abstraction.


In Encapsulation, Binding (or wrapping) code and data together into a single unit is known as encapsulation. In object-oriented programming, encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object’s components.
A java class is the example of encapsulation. Java bean class is the fully encapsulated class because all the data members are private here.
For example, Car is an abstraction – you don’t know internal working of the car but within car there are subsystems like steering, brake, clutch etc which are encapsulated.
For example: capsule, it is wrapped with different medicines.

java java tutorials learn java study java