fightingbull06@yahoo.com wrote:
Am a newbie to Java Programming and am studying Accessor Methods.
If you designate variables as "private", then you can change their
values using "accessor methods". So what's the point of making them
"private" if you can still manipulate them using accessor methods.
I find it really interesting that there are so many options available to 
the programmer in Java regarding the visibility of variables yet most 
people want you to wrap them in accessors (getters and setters :-).  One 
really handy reason to do that is to synchronize access.  That and range 
checking are probably the most valuable.  Otherwise for a read/write 
variable you've just added two more methods and the maintenance overhead 
that goes with them.  You will find some examples in Java itself of 
exposed variables, although not many in more recent code.  I know it's 
not OO but since I started programming before there was OO I don't 
really care.  The code needs to be readable, maintainable, efficient and 
most importantly it needs to be written to a budget.  A public variable 
here or there isn't going to hurt a thing.
choice of methodology now.
To Statement Considered Harmful" note. Does that mean I should use goto