Encapsulation is a way to keep data safe inside a class by making fields private. We use public methods called getters and setters to read or change the data. The setter method can check if the new value is valid before changing it. For example, in the Person class, the name field is private. The setName method only changes name if the new value is not empty. The getName method returns the current name. This way, outside code cannot directly change name to something invalid. The execution table shows how name starts as null, stays null when setName is called with empty string, and changes to "Alice" when setName is called with a valid name. This protects the data and keeps the class in control of its own state.