aspose file tools
The moose likes Java in General and the fly likes Calling  super()  method . Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Calling  super()  method ." Watch "Calling  super()  method ." New topic
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
    
    4
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 .
 
Similar Threads
call super class constructor
Constructors
Calling super() method .
Inheritance Issue
Constructors are not inherited.