| Author |
What Diff. Between MyClassName.this and this? When use each?
|
Robert Paris
Ranch Hand
Joined: Jul 28, 2002
Posts: 585
|
|
Usually I see: synchronized ( this ) { ...blah, blah... } But recently I saw: synchronized ( AdminLeaseService.this ) { ...blah, bleh..... } Is there a difference? Is one safer than the other? Is there a point where one will work and the other won't? For example, in RMI? [ August 23, 2002: Message edited by: Robert Paris ]
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
If you're inside an inner class, "this" refers to the current instance of the inner class. You also may need to refer to the current instance of the outer class - that's where notation like OuterClassName.this is necessary. I don't think there's any other use for it.
|
"I'm not back." - Bill Harding, Twister
|
 |
 |
|
|
subject: What Diff. Between MyClassName.this and this? When use each?
|
|
|