package demo06;
public class Test {
public Test(){
System.out.println("构造方法一被调用了");
}
public Test(int x){
this();
System.out.println("构造方法二被调用了");
}
public Test(boolean b){
this(1);
System.out.println("构造方法三被调用了");
}
public static void main(String[] args) {
Test test = new Test(true);
}
}
构造方法的调用
最新推荐文章于 2023-05-28 14:12:46 发布