0
What are setters and getters in java
I forgot about them as I did them many months ago. I need to relearn them
2 Answers
+ 4
In Java, setters and getters are methods used to control access to the private fields of a class, encapsulating the data. Getters (also known as accessor methods) retrieve the value of a private field, typically named getFieldName(). Setters (also known as mutator methods) modify the value of a private field, typically named setFieldName(newValue). This approach allows for validation or other logic to be applied when data is accessed or modified, promoting better data integrity and object-oriented design principles.
0
In case you forgot the course material, you can always read and do the lesson again.
Just remember it won't add to your streak.