public class Main {  
      public static void main(String[] args) {
        new B();
      }
    
       static class A {       
            public void foo() { 
                try {
                    Method m = this.getClass().getSuperclass().getMethod("foo", null);
                    m.invoke(this, null);
                } catch(Exception e) {
                    e.printStackTrace();
                }
            }
        }
        
    
        static class B extends A {
            B() { foo(); }
            
            public void foo() { super.foo(); }
        }
    }