It protects internal state and enforces constraints.
Encapsulation hides the internal workings of an object, allowing only controlled access and modification through methods. For instance, a 'Product' class with private fields and public getters/setters ensures only valid data is assigned, maintaining product integrity.