You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MethodRedirect2.java 1.1KB

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