my dog learned polymorphism*
The moose likes Java in General and the fly likes The 'this' keyword 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 » Java » Java in General
Bookmark "The Watch "The New topic
Author

The 'this' keyword

Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 152

Hi all,

I just came across this method in a piece of code I am maintaining:



I regards to the 'this' reference... I understand that 'this.BACKING_LIST' is a reference to this classes field called BACKING_LIST. What I don't understand is the 'return this' statement. What does 'this' refer to here? Does it refer to the BACKING_LIST that was referenced on the previous line; in other words could that line be re written as 'return this.BACKING_LIST;'?

Thanks,
Alan
Yogesh Gnanapraksam
Ranch Hand

Joined: Dec 17, 2009
Posts: 133
this is a reference to the current object


More details here

Just try printing 'this' to the console..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The 'this' keyword
 
Similar Threads
///call by reference///
Implicit Narrowing Conversion
Immutable Data structure
static inner classes
about string