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

What is Applet Stub Interface ?

2564


Can a class be protected in java?

1013


What is thread safe singleton?

1003


What is difference between char array and string?

1181


What is an example of a constant variable?

1147


What is the difference between replace and replace all?

1074


Which list does not allow duplicates in java?

996


What is the purpose of the file class in java programming?

1097


What’s the difference between callable and runnable?

1183


What is boolean law?

1132


Can a constructor have different name than a class name in java?

1281


Is Constructor possible in abstract class in java ?

1116


Can a static method be final?

1110


Are functions objects in java?

1128


Can we serialize singleton class?

1090