It seems to me that I am running into the so call special this a lot lately. What is the socal special this? I know that using this means the implicit reference to the object that the method is invoked on, generally. So what is the deal with the format of classname.this.something-else?
Let us be showered in the light of confusion!
posted 13 years ago
That is actually called a qualified this statement. Here's an example from my mock exam.
The qualified this expression is used within an inner class to access a member of an enclosing class when the enclosing class member is hidden by a member of the inner class. A similar situation exists when a member of a subclass hides a member of a super class. In that case you would just cast "this" to the type of the superclass.
Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>