Inheritance in java

Is super class object gets initiated while creating the subclass object? what happen in heap and stack when call super class method from subclass and call super class constructor by using super keyword from subclass?

Questions by jpjese

Showing Answers 1 - 1 of 1 Answers

sarath

  • Jul 21st, 2011
 

yup its intiated as for inheritance.. the object will be created in heap and as you would probably know that superclass constructor is called when subclass constructor is called..

but first the superclass constructor is called as super() fun is implicitly called by the constructor of the subclass and as super() is called the constructor of subclass is now will be in stack and then the superclass constructor gets called..

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions