public class AA {
private static int _var =1;
{
System.out.println("外部类构造_1_" + System.currentTimeMillis());
}
AA() {
System.out.println("外部类构造_2_" + System.currentTimeMillis());
}
static {
System.out.println("外部类静态块加载" + System.currentTimeMillis());
}
public static class BB{
private static int _bb_static_1 =12;
static {
System.out.println("内部类静态加载" + System.currentTimeMillis());
}
BB() {
System.out.println("内部类构造" + System.currentTimeMillis());
}
}
public static void main(String[] args) {
System.out.println(BB._bb_static_1);
System.out.println(BB._bb_static_1);
new AA();
}
}
执行结果:
外部类静态块加载1571897780400
内部类静态加载1571897780405
12
12
外部类构造_1_1571897780406
外部类构造_2_1571897780406
网友评论