What is Encapsulation in oops with an example?
The process of binding up data and functions together that manipulates them is known as encapsulation in OOPS. It protects the data from outside interference and misuse.
Let’s understand the concept of encapsulation with both real-world examples and with the help of a program.

BY Best Interview Question ON 03 Nov 2021
Example
class Account {
private int account_number;
private int account_balance;
public void show Data() {
//code to show data
}
public void deposit(int a) {
if (a < 0) {
//show error
} else
account_balance = account_balance + a;
}
}