Why Should I Write Getters and Setters?


Why Should I Write Getters and Setters? – When I started my career in Java, I was confused about getters and setters. One question always comes to mind: Why should I write getters/setters? It looked like some kind of weird syntax to me. I learned that through the public access modifier, one field of a class is accessible to any packages, and with getters/setters, I am actually doing the same thing — making the field private while the getter/setter method is public, so i… http://ow.ly/DTqM50aXFwx

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s