I am a beginner programmer and I am having trouble understanding the need for getters and setters in Java.I know that getters are used to read a variable that may be private and setters are used to change that variable. My question is are getters and setters mainly useful for when there are multiple programmers writing code for one application? or do the access modifiers protect the declared variables from being changed by other parts of the code within the application?
Asked
Active
Viewed 32 times