Saturday, 1 June 2019

Difference between Abstraction and Encapsulation in Java


Encapsulation is a process of binding or wrapping the data and the codes that operate on the data into a single entity. This keeps the data safe from outside interface and misuse. Encapsulation is implemented using private, package-private and protected access modifier.

Encapsulation is also called data hiding.


Abstraction is the process used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface).

Abstraction can be achieved using interface and abstract class.

Hide certain details and only show the essential features of the object.



No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...