1 import java
.lang
.reflect
.*;
18 class arse
implements one
, two
20 public int n(int N
) { return N
; }
21 public int nn(int N
) { return N
*2; }
24 class arsey
implements two
, one
, three
26 public int n(int N
) { return N
*4; }
27 public int nn(int N
) { return N
*8; }
28 public int nnn(int N
) { return N
*16; }
31 public class InvokeInterface
extends arse
37 static two flunk
= new arse();
38 static three flunkey
= new arsey();
39 public static void main(String
[] s
) throws Throwable
41 Class
[] argtypes
= {Integer
.TYPE
};
42 Method m
= two
.class.getMethod("nn", argtypes
);
43 Object
[] args
= {new Integer(1)};
44 System
.out
.println(flunk
.nn(1));
45 System
.out
.println(m
.invoke(new arse(), args
));
46 m
= arse
.class.getMethod("nn", argtypes
);
47 System
.out
.println(m
.invoke(new arse(), args
));
48 m
= two
.class.getMethod("nn", argtypes
);
49 System
.out
.println(m
.invoke(new arsey(), args
));
50 m
= three
.class.getMethod("nnn", argtypes
);
51 System
.out
.println(m
.invoke(new arsey(), args
));
52 m
= arsey
.class.getMethod("nnn", argtypes
);
53 System
.out
.println(m
.invoke(new arsey(), args
));