-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise23.java
40 lines (35 loc) · 899 Bytes
/
Exercise23.java
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
39
40
class One {
static int one = printInit("one.initiaalized");
static int printInit(String s){
System.out.println(s);
return 1;
}
}
class Two extends One{
static int two = printInit("two.initialized");
Two(){
System.out.println("two constructor");
}
}
class Three {
static int n = printInit("Three.initialized");
static One one = new One();
Three(){
System.out.println("Three construtor");
}
static int printInit(String s){
System.out.println(s);
return 3;
}
}
public class Exercise23 extends Two{
static int i = printInit("Exercise23.initialized");
Exercise23(){
System.out.println("Exercise23 constructor");
}
public static void main(String[] args){
System.out.println("main");
Exercise23 ex = new Exercise23();
System.out.println(Three.one);
}
}