What are the getter and setter methods in Java?
Answers
Answered by
1
Answer:
In Java, getter and setter are two conventional methods that are used for retrieving and updating the value of a variable. So, a setter is a method that updates the value of a variable. And a getter is a method that reads the value of a variable. Getter and setter are also known as accessor and nutator in Java.
Answered by
1
Answer:
it is used to access private variables that you have declared
Similar questions