A method called an accessor returns the value of a static or instance variable to the user. The method header should substitute the return type for the keyword void because the method is returning a value to the user.
What is an example of a Java accessor method?
Accessor methods in Java return a private variable's value. Other classes can access the value that is stored in the variable through this method without having direct access to the variable itself. Accessor methods don't require any parameters and return a value with the same type as the variable they are accessing.
What exactly are mutator methods and accessor methods?
A method is referred to as an accessor method if it allows access to the value of a (possibly private) instance variable, while a method is referred to as a mutator method if it allows changes to the value of a (possibly private) instance variable.
To know more about Accessor method visit;
https://brainly.com/question/29589475
#SPJ4