Subclass object creation process details

       If the constructor of a subclass of the first line to write this call other constructors of this class, then call the parent class super statement still available?

       This time is not, because this () or Super (), is defined only in the first line configuration method, because the initialization operation must be executed.

       Is there an implicit super constructor does the parent class?

       Is there. Remember: as long as the first line of the default constructor is super ();

       Parent parent who is it? In the end who is super constructor call it?

       Java system design, definition of a parent class of all objects Object

 

note:

       The default constructor class first row has implicit super () statement, null constructor parameters in accessing the parent class. Therefore the constructor of the parent class either to their object initialization, you can give your own subclass object initialization.

       If the default implicit super () statement does not correspond to the constructor of the parent class, you must pass this form constructor or super clear to call in the constructor.

Published 120 original articles · won praise 5 · Views 2622

Guess you like

Origin blog.csdn.net/weixin_41874888/article/details/104104430