Last change
on this file was 1389, checked in by bird, 21 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:
430 bytes
|
Line | |
---|
1 | class X
|
---|
2 | {
|
---|
3 | public Y getY()
|
---|
4 | {
|
---|
5 | return new Y(1);
|
---|
6 | }
|
---|
7 | }
|
---|
8 |
|
---|
9 | class Y extends X
|
---|
10 | {
|
---|
11 | int i;
|
---|
12 |
|
---|
13 | Y(int i)
|
---|
14 | {
|
---|
15 | this.i = i;
|
---|
16 | }
|
---|
17 |
|
---|
18 | public Y getY()
|
---|
19 | {
|
---|
20 | return new Y(2);
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | class A
|
---|
25 | {
|
---|
26 | X x = new Y(-1);
|
---|
27 | public X getX() { return x; }
|
---|
28 | }
|
---|
29 |
|
---|
30 | public class PR6204 extends A
|
---|
31 | {
|
---|
32 | public Y getY() { return super.getX().getY(); }
|
---|
33 |
|
---|
34 | public static void main(String[] args)
|
---|
35 | {
|
---|
36 | System.out.println (new PR6204().getY().i);
|
---|
37 | }
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.