Abstraction | Encapsulation |
It separates Interface and Implementation. | It groups together related concepts into one item. |
It provides access to a specific part of data. | It hides data and the user cannot access the same directly (data hiding). |
It gives a coherent picture of what the user wants. The degree of relatedness of an encapsulated unit is defined as cohesion. High cohesion is achieved by means of good abstraction. | Coupling means dependency. Good systems have low coupling. Encapsulation results in lesser dependencies of one object on other objects in a system that has low coupling. Low coupling may be achieved by designing a good encapsulation. |
Abstraction is defined as a data type called as a class which separates interface from implementation. | Encapsulation packages data and functionality and hides the implementation details (information hiding). |
The ability to encapsulate and isolate design from execution information is known as abstraction. | Encapsulation is a concept embedded in abstraction. |
[…] Difference between abstraction and encapsulation in java […]