Java "this" and inner class

Posted by llm on Stack Overflow See other posts from Stack Overflow or by llm
Published on 2010-04-28T17:22:45Z Indexed on 2010/04/28 18:17 UTC
Read the original article Hit count: 264

Filed under:
|

Is it possible to get a reference to this from within a Java inner class?

i.e.

Class outer {

  void aMethod() {

    NewClass newClass = new NewClass() {
      void bMethod() {
        // How to I get access to "this" (pointing to outer) from here?
      }
    };

  }

}

© Stack Overflow or respective owner

Related posts about java

Related posts about inner-classes