source: branches/libc-0.6/src/gcc/libjava/testsuite/libjava.lang/InterfaceDispatch.java@ 3103

Last change on this file since 3103 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 6.3 KB
Line 
1/* Test interface dispatch, type checking (instanceof), and casting. */
2
3interface IA
4{
5 String a();
6}
7
8interface IB extends IA
9{
10 String b();
11}
12
13interface IC extends IB
14{
15 void c();
16 int d();
17 IB e(int i);
18}
19
20interface ID
21{
22 String z();
23 String a();
24}
25
26class CA
27{
28 String a()
29 {
30 return "CA a()";
31 }
32}
33
34class CB implements IB
35{
36 public String a()
37 {
38 return "CB a()";
39 }
40
41 public String b()
42 {
43 return "CB b()";
44 }
45}
46
47class CC extends CB
48{
49 public int d()
50 {
51 return 99;
52 }
53}
54
55class CD extends CC implements IC
56{
57 public String a()
58 {
59 return "CD a()";
60 }
61
62 public void c()
63 {
64 System.out.println("CD c()");
65 }
66
67 public int d()
68 {
69 return 6;
70 }
71
72 public IB e(int i)
73 {
74 if (i == 1)
75 return new CB();
76 else
77 return new CD();
78 }
79}
80
81class CE extends CB implements IB, ID
82{
83 public String a()
84 {
85 return ("CE a()");
86 }
87
88 public String b()
89 {
90 return ("CE b()");
91 }
92
93 public String z()
94 {
95 return("CE z()");