public class Animal {
static String name="小黑";

public Animal() {
name = "小猿";
showName();
}
public void showName(){
System.out.println(this.name);
}

public static void main(String[] args) {
Cat cat = new Cat();
}
}

class Cat extends Animal {
String name = "小智";

public void showName(){
System.out.println(this.name);
}
}


执行顺序是基类静态域-》cat类静态域-》基类成员变量初始化-》基类构造器-》cat类成员变量初始化-》执行cat类构造器里的内容