• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The 'this' keyword

 
Alan Smith
Ranch Hand
Posts: 185
Firefox Browser Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is a reference to the current object


More details here

Just try printing 'this' to the console..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic