63.1k views
7 votes
What are the uses of an interface in encapsulation?

User Tuwana
by
3.4k points

2 Answers

9 votes
Ans: As you can see in the above examples, encapsulation is implemented in Java using interfaces, classes, access modifiers, setters and getters. A class or an interface encapsulates essential features of an object. Access modifiers (private, public, protected) restrict access to data at different levels.
User Srishtigarg
by
3.5k points
7 votes

Answer:

As you can see in the above examples, encapsulation is implemented in Java using interfaces, classes, access modifiers, setters and getters. A class or an interface encapsulates essential features of an object. Access modifiers (private, public, protected) restrict access to data at different levels. I don't know If this helps

User Notaorb
by
3.3k points