If you use this() or super() call in your constructor to call another constructor, it should always be the first statement in your constructor.
This is why your below code does not compile: -
Foo(Double a) { Double b = a + 10; this(a, b); }
You can change it to follow the rule above: -
Foo(Double a) { this(a, a + 10);
Rohit jain
source share