Encapsulation in Java: Hiding Data and Protecting Invariants