Access Modifier
- accessor methods: return a value
- string, int - type of value that is returned
- mutator/modifier methods: change object
- change location (String newLocation)
- void - not return value
- haveABirthday changes age but no output
Constructor
- sets parameters for object
- public Person(String name, int age, String Location)
- commonly have to write constructor with parameters on ap test
- allow creation of object
- Person student = new Person ("Iris", 17, "San Diego")
Modifiers/Setters
- usually mutator/modifier method
- does not return a value (void)
- public void haveABirthday();
- changes the age of Person - year has passed
- no output of new age but only modifies the previous age set
- public void changeLocation(string newLocation)
Getters
- usually use accessor methods
- get a value
- public int getAge()
- creates a method to get the age from the object