Does class inherit constructor of superclass Java?

Constructors are not inherited . The superclass constructor can be called from the first line of a subclass constructor by using the keyword super and passing appropriate parameters to set the private instance variables of the superclass.

Sizin İçin Seçtik  What are constructors in subclass?

Leave a Reply

Your email address will not be published. Required fields are marked *