File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes this  in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "this  in java " Watch "this  in java " New topic

this in java

Raj kalaria
Ranch Hand

Joined: Sep 08, 2005
Posts: 72
Can some one clear my concepts of this key word in java . I always get confused can plz some one explain me . i would appreciate it
kwame Iwegbue
Ranch Hand

Joined: Sep 02, 2000
Posts: 197
it is usually used to refer to the current instance, in cases where there might be some ambiguity about which variable you're referring to.

Who dares, wins! (SAS motto)
Raj kalaria
Ranch Hand

Joined: Sep 08, 2005
Posts: 72
thank you
Ko Wey
Ranch Hand

Joined: Sep 08, 2003
Posts: 67
I hope I don't write anything foolish, but I see it as
a reference to the current instance of the class, the "thing" that
is constructed by the constructor. See code:

I hope I don't make matters worse...
Adam Richards
Ranch Hand

Joined: Nov 03, 2005
Posts: 135
I agree. Here's the link:
subject: this in java
It's not a secret anymore!