1 package test3; 2 3 interface MethodRedirect2SupIntf { foo()4 int foo(); bar()5 int bar(); bar2()6 int bar2(); 7 } 8 9 interface MethodRedirect2Intf extends MethodRedirect2SupIntf { bar2()10 int bar2(); 11 } 12 13 class MethodRedirect2SupSup { bfo()14 public int bfo() { return 100; } bfo2()15 public int bfo2() { return 200; } 16 } 17 18 class MethodRedirect2Sup extends MethodRedirect2SupSup { afo()19 public int afo() { return 10; } afo2()20 public int afo2() { return 20; } bfo()21 public int bfo() { return 300; } 22 } 23 24 public class MethodRedirect2 extends MethodRedirect2Sup implements MethodRedirect2Intf { foo()25 public int foo() { return 1; } bar()26 public int bar() { return 2; } bar2()27 public int bar2() { return 3; } 28 test(MethodRedirect2Intf intf, MethodRedirect2 clazz, MethodRedirect2SupSup sup)29 public int test(MethodRedirect2Intf intf, MethodRedirect2 clazz, 30 MethodRedirect2SupSup sup) 31 { 32 return intf.bar() + intf.bar2() + clazz.afo() + clazz.bfo() + sup.bfo(); 33 } 34 test()35 public int test() { 36 MethodRedirect2 obj = new MethodRedirect2(); 37 return test(obj, obj, obj); 38 } 39 main(String[] args)40 public static void main(String[] args) { 41 System.out.println(new MethodRedirect2().test()); 42 } 43 } 44