62,614
社区成员
发帖
与我相关
我的任务
分享
package Test_01;
public class Test {
public static int a = 0;
static {
a = 10;
System.out.println("静态代码块在执行a=" + a);
}
{
a = 8;
System.out.println("非静态代码块在执行a=" + a);
}
public Test() {
this("带参构造方法在执行a="+a); // 调用另外一个构造方法
System.out.println("无参构造方法在执行a=" + a);
}
public Test(String n) {
System.out.println(n);
}
public static void main(String[] args) {
Test t = null;
System.out.println("!!!!!!!!!!!!!!!!!!!!!");
t = new Test();
}
}