Pages

Tuesday 10 May 2016

Difference between Abstraction and Encapsulation in Java

Abstraction - hiding implementation using abstract class and interfaces etc.
Abstraction represent taking out the behavior from how exactly it’s implemented.

Example: Abstraction in Java is interface.


Encapsulation - data hiding
While Encapsulation means hiding details of implementation from outside world so that when things change nobody gets affected.

Example: Java is private methods.

No comments:

Post a Comment