java程序填空题?

2024-11-03 02:33:37
推荐回答(2个)
回答(1):

public class Main {


public static void main(String[] args) {


Test test = new Test(true);


}


}

class Test {


public Test(){


System.out.println("Constructor one invoked!");


}
public Test(int x){


//此处添加代码


           Test();


System.out.println("Constructor two invoked!");


}
public Test(boolean b){


//此处添加代码


    Test(1);


System.out.println("Constructor three invoked!");


}
}

回答(2):

从上到下依次写入:
1)this();
2)this(0);