Computer Applications
Explain the term Encapsulation using appropriate examples.
OOP Intro Java
53 Likes
Answer
Encapsulation is a mechanism that binds together code and the data it manipulates. It keeps them both safe from the outside world, preventing any unauthorised access or misuse. Only member methods, which are wrapped inside the class, can access the data and other methods. For example, an ATM contains different denominations of currency notes and it provides a set operations to the user to withdraw money. The different denominations of currency notes is the data, the set of operations are the methods and the ATM encapsulates them into a single unit enabling us to withdraw cash conveniently.
Answered By
29 Likes