andalusian
Season - Restarted
- Joined
- Sep 24, 2008
- Messages
- 15,290
- Likes
- 14,782
- Points
- 113
I really can't improve on Oxford:
this
pronoun
pronoun: this; pronoun: these
From the Java online documentation:
Within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using this.
The this keyword refers to the current object in a method or constructor.
The most common use of the this keyword is to eliminate the confusion between class attributes and parameters with the same name (because a class attribute is shadowed by a method or constructor parameter). If you omit the keyword in the example above, the output would be "0" instead of "5".
this can also be used to:
- Invoke current class constructor
- Invoke current class method
- Return the current class object
- Pass an argument in the method call
- Pass an argument in the constructor call