Why default constructor of base class will be called first in java?

Showing Answers 1 - 6 of 6 Answers

ziaur rahuman

  • Dec 12th, 2005
 

Bcoz before initializing the default value of sub class the super class should be initialized

  Was this answer useful?  Yes

Mark

  • Dec 12th, 2005
 

Because from any constructor of the subclass first a call is made to super() unless you specifically make any super call with args() eg super(arg1,arg2).

  Was this answer useful?  Yes

saurabhj

  • Dec 16th, 2005
 

because subclass inherits all the methods and fields(elgible one) of base class, so base class is constructed in the process of creation of subclass object (subclass is also an object of superclass)

  Was this answer useful?  Yes

suresh Kumar Saini

  • Jan 19th, 2006
 

Default Constructor is used to initilize the instance variable of the sub class

  Was this answer useful?  Yes

whenever v create an object of  child class ,automatically an obj of parent class is also created,with this what i mean is that data members of base class also accessible ,provided access specifier permits.

When  obj of child class is created its constructor is called ,form which base class constructor is called and then cursor returns to child class constructor.

  Was this answer useful?  Yes

santukt

  • Apr 15th, 2006
 

Simply bcoz in real world in order to construct a new thing based on another what we will construct first.Remenber The rule is no only applicable to default constructor but to parameterised constructor also.

  Was this answer useful?  Yes

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