Reputation:
I am learning Java and have been given these options:
How can you implement encapsulation in a class?
My choice is the second but I also would like to find out if anyone considers any other choice is correct? Also are there any other ways to implement encapsulation that are not covered here?
Upvotes: 0
Views: 4275
Reputation: 8548
You're right. Any other method is to define an interface which will be encapsulate functionality of implementation class.
from Wikipedia:
encapsulation is:
Upvotes: 1