You are viewing a single comment's thread from:

RE: USING GETTER AND SETTER IN JAVA

So anyone can set the value from outside of the class by just using .. So to prevent anyone from using your variable you can use getter and setter.

This doesn't make much sense to me. There is really no difference between making a variable public and having public getters/setters, like those you have.
It's only useful if the setter actually does anything(like checking if the age is non-negative).

Coin Marketplace

STEEM 0.17
TRX 0.25
JST 0.034
BTC 95865.23
ETH 2807.98
SBD 0.67