Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 5
In simple word
Encapsulation means hiding veriable and method outside from class.
Example
public class Vehicle {
private String color;
// Getter
public String getColor() {
return color;
}
// Setter
public void setColor(String c) {
this.color = c;
}
}