| Author |
Calling super() method .
|
Praveen Kumar
Ranch Hand
Joined: Nov 06, 2006
Posts: 133
|
|
At java, We need to call super class constructor in base class constructor at first line itself , other wise compiler will kick . Could any one explain me why we need to put at first line itself ?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
More of a beginner's question. Look at this tutorial about the Object class, and this tutorial about super(). Imagine you have a class which is partially made up from parts unchanged from its superclass and partially from parts it has itself. To set up an object you have to set up the parts from the class and the parts from the superclass. Well, Java insists you set up the parts from the superclass first. If you search above you find old discussion including this, this and this.
|
 |
 |
|
|
subject: Calling super() method .
|
|
|