blob: 06eb43d332e9b451105e980ad066814e3f3a45c3 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 | class X
{
  public Y getY()
  {
    return new Y(1);
  } 
}
class Y extends X
{
  int i;
  Y(int i)
  {
    this.i = i;
  }
    
  public Y getY()
  {
    return new Y(2);
  } 
}
class A
{
  X x = new Y(-1);
  public X getX() { return x; }
}
public class PR6204 extends A
{
  public Y getY() { return super.getX().getY(); }
  
  public static void main(String[] args)
  {
    System.out.println (new PR6204().getY().i);
  }
}
 |