daily life example of encapsulation
Answers
Answer:
Every Java class is an example of encapsulation because we write everything within the class only that binds variables and methods together and hides their complexity from other classes. Another example of encapsulation is a capsule. Let's understand Encapsulation in java by taking real-time examples.
Real-time Example 1:
School bag is one of the most real examples of Encapsulation. School bag can keep our books, pens, etc.
Real-time Example 2:
When you log into your email accounts such as Gmail, Yahoo mail, or Rediff mail, there is a lot of internal processes taking place in the backend and you have no control over it. When you enter the password for logging, they are retrieved in an encrypted form and verified and then you are given the access to your account. You do not have control over it that how the password has been verified. Thus, it keeps our account safe from being misused.
Real-time Example 3:
Suppose you have an account in the bank. If your balance variable is declared as a public variable in the bank software, your account balance will be known as public, In this case, anyone can know your account balance.
hope it helps and mark as branilist please
Answer:
hope it helpsss
EXAMPLES OF ENCAPSULATION