Distinguish between abstraction and encapsulation| difference between abstraction and encapsulation in java

difference between abstraction and encapsulation in java

difference between abstraction and encapsulation in java

AbstractionEncapsulation
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.
Previous articleHistory of java | history of JAVA in a tabular form.
Next articledata science interview questions and answers |Python data science interview questions.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here