title: How can objects of a nested classes access the object that they're nested in?
body: <p>How do I get the parent this object from a method in the inner class?</p>
  
  <pre><code>class OuterClass {
      public outerMethod() {
           // this refers to the object in the outer class
      }
      class InnerClass {
          public innerMethod() {
               // this refers to the object in the inner class
               // How do I get my current parent object
          }
      }
  }
  </code></pre>
  
  <p>One way is to add a method like</p>
  
  <pre><code>public OuterClass getthis() {
      return this;
  }
  </code></pre>
  
  <p>Any other suggestions? Is there a way from java itself ?</p>