简体   繁体   中英

In java why always child class call the super class constructor ? I want to the internal flow

I know how these stuff flow but I want to know when we make the object of child class it calls the parent class no arg constructor first. But i want to know the internal thing.

The parent class constructor needs to be called before the subclass constructor. This will ensure that if you call any methods on the parent class in your constructor, the parent class has already been set up correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM