-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaticControl2.java
More file actions
58 lines (48 loc) · 1.01 KB
/
StaticControl2.java
File metadata and controls
58 lines (48 loc) · 1.01 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Static Control flow in IS-A relationship.
1. Identification of static members from parent to child. [1-11]
2. Execution of static variable assignments and static blocks form parent to child. [12-22]
3. Execution of only child class main method. [23-25]
*/
class Base
{
static int i=10; //1
static //2
{
mth1();
System.out.println("Base static block");
}
public static void main(String[] args) //3
{
mth1();
System.out.println("Base main");
}
public static void mth1() //4
{
System.out.println(j);
}
static int j=20; //5
}
public class StaticControl2 extends Base
{
static int x=100; //6
static //7
{
mth2();
System.out.println("derived first static block");
}
public static void main(String[] args) //8
{
mth2();
System.out.println("Derived main");
}
public static void mth2() //9
{
System.out.println(y);
}
static //10
{
System.out.println("Derived second static block");
}
static int y= 200; //11
}