Quantcast
Channel: Java setter and getter? - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by kostja for Java setter and getter?

$
0
0

The support for "data hiding" can be explained by the fact that the getter and setter methods are like gateways to the data.

It is only by convention - the JavaBeans convention to be exact - that it is expected from them to operate on the member they are named after. They could do anything else and it would still be perfectly compilable and legal java.


Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>