Why Use Getters/Setters Instead of Public Fields?
Dec 26, 2022 · 4 min read · TLDR; Because it makes it easier to change our code later Getters and setters are methods that are used to read/write an object's private field. They might not seem useful since you can achieve the same task with public fields, but they are useful be...
Join discussion