+ 2
Why should we use getter & setter methods in Java??
Quick access on the variable's value!!
2 Answers
+ 1
Getter method is used to return the variable's value.
Setter method is used to set the variable's value.
+ 1
Usually because encapsulation meme.
Sometimes because it allows you to do fancy stuff when changing values.