Possible Duplicate:
Java: Are Getters and Setters evil?
I have a class called Block with a simple boolean in it called inUse. For example in an if statement elsewhere in the program is it better to use a method called inUse() that returns the inUse boolean or just reference the variable with block.inUse
e.g.
if(block.inUse == true) // do something
or should I use
if(block.inUse()) //do something
where inUse() would be a simple return method in the block class
boolean inUse() {
return inUse }
Thanks