The 'this' keyword
Sometimes a method will require referring to the object which invoked it. To permit this, java describes the 'this' keyword. This could be used within any method to refer to the current object. That is always a reference to the object on that the method was invoked. You could use this anywhere a reference to an object of the current class' type is allowing.
To understand it in a better way that what this refers to, consider the following version of box ():
// a redundant use of this.
Box(double w, double h, double d) {
This.width;
This.height;
This.depth;
}
This version of box () operates accurately such like as earlier version. The use of this is redundant, but perfectly correct. Inside box (), this will always refer to the invoking object. Although it is redundant in this case, this is useful in other context.