Introduction: 5.5.0

  • set methods correspond with get methods to change the value of a private variable
    • also called mutator methods
    • these are void
    • take a parameter to change the private value
public class House {
    private String address;

    public void setAddress(String a) {
        address = a;
    }
}

Summary: 5.5.2

  • a void method doesn’t return a value
    • header contains void before the method name
  • a mutator method is a void method which changes the value of member variables