对的,这是可能的:
public class Foo { private int x; public Foo() { this(1); } public Foo(int x) { this.x = x; }}要链接到特定的超类构造函数而不是同一类中的构造函数,请使用
super代替
this。注意,你只能链接到一个构造函数,它必须是构造函数主体中的第一条语句。

对的,这是可能的:
public class Foo { private int x; public Foo() { this(1); } public Foo(int x) { this.x = x; }}要链接到特定的超类构造函数而不是同一类中的构造函数,请使用
super代替
this。注意,你只能链接到一个构造函数,它必须是构造函数主体中的第一条语句。