Mutator Methods

Learn what a mutator method is and how to write one in Java.

What is a mutator method?

A mutator method is often a void method that changes the values of instance variables or static variables.

A void method does not return a value. Its header contains the void keyword before the method name.

Explanation

Here is an example:

Get hands-on with 1200+ tech skills courses.