I have noticed following situation : Inner class is calling method which there is in super class of it and in outer class. Here the code:
public class Main
{
class Inner extends InnerBase{
public void callMethod(){
method();
}
}
void method(){
System.out.println ("Called Main's method");
}
class InnerBase{
void method(){
System.out.println ("Called InnerBase's method");
}
}
}
Now when callMethod() is calling it calls the method of super class and prints "Called InnerBase's method". If I am trying to 'Open Declaration' from IDE (Eclipse) on method() which is calling in callMethod(), then it goes to method in outer class. It is confusing which one is calling real. Can you suggest or provide some material which explain situation of choosing execution method with same name in outer class and in super class. Thank You in Advance.