Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if th
As everybody already have said, you use this(…)
, which is called an explicit constructor invocation.
However, keep in mind that within such an explicit constructor invocation statement you may not refer to
this
or super
.As stated in JLS (§8.8.7.1).