01: /*
02: * MethodInvoker2.java --
03: *
04: * tcljava/tests/signature/MethodInvoker2.java
05: *
06: * Copyright (c) 1998 by Moses DeJong
07: *
08: * See the file "license.terms" for information on usage and redistribution
09: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10: *
11: * RCS: @(#) $Id: MethodInvoker2.java,v 1.1 1999/05/10 04:09:08 dejong Exp $
12: *
13: */
14:
15: package tests.signature;
16:
17: public class MethodInvoker2 {
18:
19: public static class A {
20: }
21:
22: public static class B extends A {
23: }
24:
25: public static class C extends B {
26: }
27:
28: public static A getA() {
29: return new A();
30: }
31:
32: public static B getB() {
33: return new B();
34: }
35:
36: public static C getC() {
37: return new C();
38: }
39:
40: public static String call(A arg1, A arg2) {
41: return "A+A";
42: }
43:
44: public static String call(A arg1, C arg2) {
45: return "A+C";
46: }
47:
48: public static String call(B arg1, C arg2) {
49: return "B+C";
50: }
51:
52: public static void main(String[] argv) {
53: A a = getA();
54: B b = getB();
55: C c = getC();
56:
57: String s;
58:
59: s = call(a, a); //should return A+A
60: p(s);
61:
62: s = call(a, c); //should return A+C
63: p(s);
64:
65: s = call(c, a); //should return A+A
66: p(s);
67:
68: s = call(c, c); //should return B+C
69: p(s);
70: }
71:
72: public static void p(String arg) {
73: System.out.println(arg);
74: }
75:
76: }
|