java的一個類中,可能含有多個構造函數(shù),如果其中的構造函數(shù)調用其他的構造函數(shù),不能直接寫構造函數(shù)名,應該用關鍵字this調用.

  例如:

  01.public class Test{

  02. public Test(){

  03. this(1);

  04. }

  05. public Test(int i){

  06. System.out.println(i);

  07. }

  08.}