Can you use this and super both in constructor
Answer :
super() – calls the base class constructor (or call a super class constructor)
this() – calls current class constructor (constructor in the same class)
- Both this() and super() are constructor calls
- Constructor must always be the first statement
- We can not have two statements as first statement
- Either we can call super() or we can call this() from the constructor, but not both
- If both were allowed you could end up calling the super constructor twice