¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita+ 2
Why should we use getter & setter methods in Java??
Quick access on the variable's value!!
2 Respuestas
+ 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.