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 the difference between preemptive scheduling and time slicing? : Java thread

984


You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain

941


Difference between notify() method and notifyall() method in java?

921


What is the use of static methods?

1000


How does the garbage collector works in java?

1051


how to write a server program and sending the mails to the server using smtp protocol please help me

2013


What is the char data type?

949


What is java virtual machine? Explain

974


Difference between ‘>>’ and ‘>>>’ operators in java?

1086


What is the difference between declaration and definition in java?

1015


What are autoboxing and unboxing? When does it occur?

902


What are wrapper classes in java?

1020


What is heterogeneous in java?

909


How many types of threads are there in java?

1004


Can a string be null?

935