The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Pavan Kumar Keely on June 27, 2001 at 9:34 AM

> > Why in a class that doesn�t extentds an other you put iin the constructor the method "super"?

> All objects ultimately are derived from subclasses of the Object class. The call to super() in a class that doesnt explicitly extend another class is making a call to the default constructor in the Object class.

Every class in Java extends the class Object implicitly. So, to create an object of the sub class, first the object of the super class has to be created. For this the JVM will by default calls the default constructor of the super class. You can even explicitly call the super(). Even if you don't call the method explicitly, the JVM calls the default one.

Pavan Kumar Keely


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us