blob: 9ca5a50ca671af0722294cc5b2eb26e5264069d8 (
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
|
/* Listing0718.java */
public class Listing0718
{
public static String getAndPrint(String s)
{
System.out.println(s);
return s;
}
public static void main(String[] args)
{
Son son = new Son();
}
}
class Father
{
private String s1 = Listing0718.getAndPrint("Father.s1");
public Father()
{
Listing0718.getAndPrint("Father.<init>");
}
}
class Son
extends Father
{
private String s1 = Listing0718.getAndPrint("Son.s1");
public Son()
{
Listing0718.getAndPrint("Son.<init>");
}
}
|