Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

this in method parameter

 
ashok ks
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the meaning of 'this' in the following hai(this) here hai is the methood name.
 
Adam Altmann
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it's just passing whatever object called the method, into that method as it's argument. So, if the Hai method looks like:
public void Hai (Object ob){
//Do some nifty stuff to ob
}
Then when you call Hai(this) from <whateverObject>, then (a copy of the referece to) <whateverObject> is passed in to Hai (which is then used as "ob" inside the method.) Again, I believe this is correct, but I'm not 100%.
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adam Altmann:
Again, I believe this is correct, but I'm not 100%.

You are correct
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic