A mutator is a method that can modify an object. In the simplest case, a mutator just assigns a new value to one of the fields. In general, a mutator performs some computation and modifies any number of fields.
The setReal and setImag methods defined in Program are mutators. Program defines three more mutators for the Complex class, setR, setTheta, and assign. All three of these assign new values to the real and imag fields, as appropriate.
Program: Complex class mutator methods.