-2

I have a (non static) inner class and have a same method within both the inner and the outer class. How can I call the outer method within the inner method?

class User{

    public void call() {
        ...
    }
    
    public class Admin{
        public void call() {
            // I want to refer to User#call, not to Admin#call()
           // super.call() does not work here, because no inheritance
            call(); // refers to Admin#call
        }
    }
}
nimo23
  • 5,170
  • 10
  • 46
  • 75

1 Answers1

3

By applying the class name to "this":

User.this.call()
Bill Shubert
  • 496
  • 3
  • 12