Multiple choice

What is a mutator method?

  1. A getter function

  2. A setter function

  3. A constructor

  4. An overridden method

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A mutator method, commonly known as a setter, is used to modify the state of an object by changing the value of its private fields.