If the above code is analyzed then the output would be
(1) Person's no-arg constructor is invoked
(2) Invoke Employee's overloaded constructor
(3) Employee's no-arg constructor is invoked
(4) Faculty's no-arg constructor is invoked
It is because of the concept of Constructor Chaining where a superclass's constructor is called before the subclass's constructor.
In this example first the person and then employee and then the faculty "NO ARGUMENT" constructors are invoked.
My question is if it is necessary that the no arg constructor of sub class can invoke only the no argument constructor of the super/parent class?
Will the output of the code change if the person no arg constructor is line 23 is replaced by the person constructor with some arg?
Q2: Will the output of the code change if the person no arg constructor is in line 23 is replaced by the person constructor with some arg?
If you replace the no arg constructor with one with an arg(s), you will get a compilation error. You will either have to call the new arg constructor from Employee(String s) using super(...) or you can just re-insert a no arg constructor back in Person along with the arg one.
Just keep in mind that if you do the latter, your arg constructor will not be used (unless you add super to choose) i.e. the output will be the same. However, the former will print whatever you want printed.
In both cases, the order of the constructor messages will be the same regardless of the message.