package demo;
public class test08 {
public static void main(String[] args) {
// TODO Auto-generated method stub
A a = new A();
System.out.println(A.m);
}
}
class A{
//m等于什么取决于哪个在后面
static int m = 100;
static {
System.out.println("A类静态代码块初始化");
m=300;
/*
* 1.加载到内存,会产生一个类对应class对象
* 2.链接,链接结束后m=0
* 初始化<clinit>(){合并static}
*/
}
//static int m = 100;
public A(){
System.out.println("A类的无参构造初始化");
}
}