I want to call both a parent constructor and another constructor in the same subclass. Is this allowed? Also, I understand that this() has some limitations on it (having to be placed first) does super()? Can I place a call to both in the same constructor?
I want to call both a parent constructor and another constructor in the same
Share
In the same class, yes.
In the same constructor, no.
superorthishas to be the first thing in a constructor.If
superis first, thenthiscan’t be first.If
thisis first, thensupercan’t be first.They can not coexist in the same constructor.