File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Constructors
 
Similar Threads
Why I can't call the parent class constructor?
another question on constructors
OOP 4: Lookup
Constructors are not inhertied - True
Can constructor throw exception?