wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Constructors" Watch "Constructors" New topic
Author

Constructors

sridevi chaluvadi
Greenhorn

Joined: Mar 23, 2004
Posts: 12
Hi,
Could you please tell me does constructors get inherited?
thanks in advance
sridevi
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
They do not
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
Well. This is partly correct.
If you do not call the parent class constructor explicitly java automatically calls the 'no argument' constructor of the parent class, if the parent class has one. This is done in the begining of the child constructor.
If you want to call the constructor with some argument(s), then it has to be done explicitly, using super(). And should be the first statement in the child constructor.
Hope this helps.
Kaustubh.


Kaustubh. Mumbai, India.
sridevi chaluvadi
Greenhorn

Joined: Mar 23, 2004
Posts: 12
Thanks Ray and Kaustubh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Constructors