Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

Referencing the Inner or Outer Instance from Within the Inner Class
> The keyword this can be used only from within instance code. In other words, not within static code.
> The this reference is a reference to the currently-executing object. In other words, the object whose reference was used to invoke the
currently-running method.
> The this reference is the way an object can pass a reference to itself to some other code, as a method argument:
public void myMethod() {
MyClass mc = new MyClass();
mc.doStuff(this); // pass a ref to object running myMethod
}