Difference Between Abstraction and Encapsulation (With Table)

Every programmer struggles to develop an immaculate code, and for that, he must use proper tools, required software, or proper panoply from OOP concepts. Using OOP reduces the difficulty of animating information or code, improves clarity, and facilitates modification when we need to. Abstraction and Encapsulation are the two basic concepts in OOP (object-oriented programming).

The difference between Abstraction and Encapsulation is that Abstraction is a design level process whereas is Encapsulation is an execution level process.

Abstraction vs Encapsulation

The main difference between Abstraction and Encapsulation is that Abstraction is a process of concealing irrelevant data and showing only the appropriate required data on the other hand Encapsulation is mandatorily binding of data members with changeable or variable data members.

Abstraction is one of the characteristics of object-oriented programming. It is used to hide irrelevant data and show only the desired data that is useful to the user. It can be performed by using the interface link and the abstract class. With the interface, only the starting methods are available to the patron user.

Encapsulation is also a feature of OOP and it is used to bind data with mutable or mutable members, a process is also known as data hiding. Encapsulation is considered to be the main characteristic of OOP because it prevents data members from being accessed from external sources or from outside the class and it is very important in terms of security issues.

Comparison Table Between Abstraction and Encapsulation

DefinitionAbstraction is a process of concealing relevant data and showing only required data. Encapsulation is the binding of data members with changeable or variable members.
PhaseAbstraction is a design-level process.Encapsulation is an important and execution-level process.
Pivotal Capability Abstraction focuses on what class instance can do, rather than execution of class. Encapsulation promotes and binds data and also has the command of maintaining the security of the data.
UseAbstraction solves problems that arise at the beginning of the design phase. Encapsulation solves the problem of the execution phase.
ImplementationAbstraction can be executed using the different interface and abstract classes. Encapsulation can be executed by using access modifiers like public-private and protected.

What is Abstraction?

Abstraction is an OOP concept that helps in concealing the relevant data and shows only required data that is useful for the user. It hides background features and highlights key data points to reduce complexity and improve clarity for productivity.

An example of Abstraction can be, When you are assigned with the task, that is to create an online course admission portal, and the data fields provided are (name, age, current occupation, college name, payment method, Marital status, sibling’s name, vehicle number) after looking at the data fields you can interpret that some data files are not required as (vehicle number or sibling’s name) for the enrolment purpose.

So, we need to be particular and select only the required data i.e., only the required field names and this makes a proper example of abstraction in OOP because we have abandoned irrelevant data and selected only required data from the data provided.

In Abstraction, security, and privacy of data are maintained in only required data is shown for the user. Abstraction is used for initial problem solving for the design level. The only disadvantage of abstraction is it focuses on what class instance can do you rather than execution of the class.

What is Encapsulation?

Encapsulation is one of the features of the OOP concept which helps in binding up data with changeable or variable members. Encapsulation is considered an important feature in OOP because it prevents accessing of data from outsourcing or outside of the class as it is a very important feature for the security of data.

Encapsulation takes care of and addresses issues that arise at the execution level, and controls data maintenance and security. The relation can be executed by using access modifiers like public, private, and protected.

An example for Encapsulation can be a calculator, as we can understand its interface from the outside but we don’t know how it works from inside or how it functioned. We only know that when we press 1+1 we will get the correct answer.

Main Differences Between Abstraction and Encapsulation

  1. Abstraction is an OOP fundamental concept used in concealing irrelevant data and showing only required data used for the user whereas Encapsulation is binding of data member with another variable member.
  2. Abstraction solves problems at the design level where is encapsulation is used at the execution level.
  3. Abstraction only focuses on what a class instance can do instead of executing the class, Encapsulation on the other hand facilitates binding data and focuses on the execution process.
  4. Abstraction can be executed by using different Java interfaces and abstract classes where is, Encapsulationation can be executed using an access modifier that is privacy protected and public.
  5. The objects are encapsulated in Abstraction whereas objects are not needed to be abstract, which results in Encapsulation.


Abstraction and Encapsulation, both are OOP concepts. Used by every program was to develop and proper immaculate code. All abstractions and encapsulations are operational concepts but they are different in their way.

Abstraction helps in solving initial design problems and also helps in hiding irrelevant data and Encapsulation helps in binding of data with proper security while maintaining transparency in data, thus Encapsulation becomes an important feature in OOP fundamental concept.


  1. https://dl.acm.org/doi/pdf/10.1145/948415.948418
  2. https://link.springer.com/content/pdf/10.1007/978-1-4471-0115-4_7.pdf