/**
* 类静态变量首先初始化 若存在父类 向上追溯 从父到子 以此类推
* 执行主方法
* 初始化对象 若存在父类 向上追溯 变量到构造函数 以此类推
*/
class P{
public static void p(String s){
System.out.println(s);
}
}
class Insect{
private int i = 9;
protected int j;
Insect(){
P.p("step4:"+"i = " + i + ", j = " + j);
j = 39;
}
private static int x1 = printInt("step1:"+"Insect.x1 ");
static int printInt(String s){
P.p(s);
return 47;
}
}
public class Beetle extends Insect{
private int k = printInt("step5:"+"Beetle.k ");
public Beetle(){
P.p("step6:"+"k= " + k);
P.p("step7:"+"j= " + j);
}
private static int x2 = printInt("step2:"+"Beetle.x2 ");
public static void main(String[] args){
P.p("step3:"+"Beeeee");
Beetle b = new Beetle();
}
}