When using instance variables within a class, is there any advantage to directly referencing the instance variable versus using a getter? Which is more commonly seen?
Example using method calls:
public double howMuchFreeSpace() {
return getCapacity() - getVolume();
Example referencing instance variables:
public double howMuchFreeSpace() {
return this.capacity - this.volume;