The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000



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.


Dynamic Object

Posted by cannyq on September 27, 2000 at 1:52 PM

> It is generally said that one has to create a reference of the
> base class in order to refer to its objects. Like in case of
> RunTime polymorphism in order to execute the method of the base
> class one has to create the reference of the base class. Why is
> it so ??

You only need to create an instance of the object (with the "new" operator) if you want to access its instance methods. But if you want to call the class' static methods, you don't have to create an instance. For example, YourClass.yourFunction(). Hope this helps.


Sponsored Links

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