01: /*
02: * MethodInvoker1.java --
03: *
04: * tcljava/tests/signature/MethodInvoker1.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: MethodInvoker1.java,v 1.1 1999/05/10 04:09:08 dejong Exp $
12: *
13: */
14:
15: package tests.signature;
16:
17: public class MethodInvoker1 {
18:
19: public static class A {
20: }
21:
22: public static class B extends A {
23: }
24:
25: public static A getA() {
26: return new A();
27: }
28:
29: public static B getB() {
30: return new B();
31: }
32:
33: public static String call(A arg1, A arg2) {
34: return "A+A";
35: }
36:
37: public static String call(A arg1, B arg2) {
38: return "A+B";
39: }
40:
41: public static void main(String[] argv) {
42: A a = getA();
43: B b = getB();
44:
45: String s;
46:
47: s = call(a, a); //should return A+A
48: p(s);
49:
50: s = call(a, b); //should return A+B
51: p(s);
52:
53: s = call(b, b); //should return A+B
54: p(s);
55:
56: s = call(b, a); //should return A+A
57: p(s);
58: }
59:
60: public static void p(String arg) {
61: System.out.println(arg);
62: }
63:
64: }
|