-2

Sorry for the basic question. But it was like 3 years ago since I encountered this case.

I have this code

class ParentClass {
   ...

   class InnerClass {
      ...
      // 'this' call here
      ...
   }
}

I would appreciate it if you could answer these questions for me:

  1. How can I get the instance of ParentClass using this notation?
  2. How can I get the instance of InnerClass using this notation?

Cheers!

user1506104
  • 5,648
  • 2
  • 59
  • 76

1 Answers1

3

May this answer will help you out you can access parent class method and variable by like this

ParentClassName.this.methodname()

Keyword for the outer class from an anonymous inner class

Community
  • 1
  • 1
Nishant Dixit
  • 5,110
  • 4
  • 14
  • 25