构造函数中包含较少参数的构造函数

mik*_*eck 4 java constructor

我有构造函数树(int a,int b,int c)和第二个构造函数树(int a,int b,int c,String s).如何从第一个加载第二个构造函数只是为了保存写入所有逻辑?我想过这样的东西,但它给了我"空"的对象.

public Tree(int a, int b, int c){
    Tree t1 = new Tree(a, b, c, "randomString");
}
Run Code Online (Sandbox Code Playgroud)

Rob*_*Rob 10

神奇的词是this,例如

public Tree( int a, int b, int c, String d ) {
    // Do something
}

public Tree( int a, int b, int c ) {
    this( a, b, c, "randomString" );
}
Run Code Online (Sandbox Code Playgroud)