After I have written a get method in a java class, is it better to use the get method in the same class or the variable itself?
For example:
if(a.getWidth()>this.getWidth())
or:
if(a.getWidth()>this.width)
Also I am confused if i should be using the this.anything so much. It seemed easier to read when comparing objects of the same type to each other.
1) It may seem from inside a class that there is no difference between using field and getter but what if a getter is overridden by a subclass?
B.getDescription() is expected to return an extended address but it wouldnt. It would if A.getDescription() was implemented as
2) I personally dont use
thisfor readability because IDE marksthiswith a different color