I have an object in which the constructor’s job is to set the fields and they aren’t set up or changed after that, ever. However, I need a getter for them. Then, do I need to have setters even though I won’t ever use them “just in case” or I can remove them and leave the getters only while leaving setting the values to the constructor?
Share
According to the java bean specification, it is legal to omit a getter or setter
method. so, you can safely omit the setter if you never use them