S.No
|
Abstraction
|
Encapsulation
|
1
|
Abstraction
is implemented in Java using interface and abstract class
|
Encapsulation
is implemented using private, package-private and protected access modifier
|
2
|
It
focuses on the outside view of an object
|
It
prevents clients from seeing it's inside view, where the behavior of the
abstraction is implemented
|
3
|
It
solves the problem in the design side
|
It
solves the problem in the Implementation
|
4
|
No rule
for exceptions
|
Checked
exception should not increase. There is no rule for unchecked exception
|
Encapsulation is the deliverables of Abstraction. Encapsulation barely talks about grouping up your abstraction to suit the developer needs.
No comments:
Post a Comment