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.

MethodRedirectToStatic.java 445B

12345678910111213141516171819202122
  1. package test3;
  2. public class MethodRedirectToStatic {
  3. public static void main(String[] args) {
  4. System.out.println(new MethodRedirectToStatic().test());
  5. }
  6. int add(int a, int b) {
  7. return a + b;
  8. }
  9. public int test() {
  10. return add(1, 2);
  11. }
  12. }
  13. class MethodRedirectToStatic2 {
  14. public static int add2(MethodRedirectToStatic target, int a, int b) {
  15. return target.add(a * 10, b * 10);
  16. }
  17. }