my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Special this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Special this" Watch "Special this" New topic
Author

Special this

Chung Huang
Ranch Hand

Joined: Jun 21, 2002
Posts: 56
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!
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
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>
 
Consider Paul's rocket mass heater.
 
subject: Special this
 
Similar Threads
reading URL parameters in jsp
Best source for CIW Database Specialist?
customize Eclipse About dialog's about text
"Apache Struts 2 Web Application Development " - Struts and Groovy/Grails
is this bug in windows?