Java Reference
In-Depth Information
The this Keyword
Before concluding this chapter, it is necessary to introduce
this
. When a method is called, it
is automatically passed an implicit argument that is a reference to the invoking object (that
is, the object on which the method is called). This reference is called
this
. To understand
this
, first consider a program that creates a class called
Pwr
that computes the result of a
number raised to some integer power: