can a constructor call another constructor java code example
Example 1: java call another constructor
public class Foo {
private int x;
public Foo() {
this(1);
}
public Foo(int x) {
this.x = x;
}
}
Example 2: call constructor from another c++
//You can use delegating constructor (since C++11) like this:
Foo(int iX) {
// ...
};
Foo() : Foo(10) {
}