Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Can a class inherit the constructors of its superclass?

Answer Posted / qim2010

No. A class cannot inherit constructor of its superclass but
can call the superclass constructor. If a class called
“SpecialPet” extends your “Pet” class then you can use the
keyword “super” to invoke the superclass’s constructor. E.g.

public SpecialPet(int id) {
super(id); //must be the very first statement in the
constructor.
}

To call a regular method in the super class use:
“super.myMethod( );”. This can be called at any line

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do constructors use this() and super()?

1111


Does constructor be static?

1030


Differentiate storage classes on the basis of their scope?

1169


What do you mean by of string::valueof expression in java 8?

961


What is a top level class in java?

1017


What is nullpointerexception in java?

1138


What is the java idl system?

1036


What is the meaning of nullable?

1008


Explain about narrowing conversion in java?

1000


What is the major difference between linkedlist and arraylist?

1035


How does linkedlist work in java?

917


What is java reflection?

974


What is the default execution method in java?

1193


Why arraylist is not synchronized in java example?

1056


What does int [] mean in java?

1026