The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 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.



Posted by Matt Gerrans on December 10, 2001 at 5:27 PM

> > Why might we wish to define an abstract class?
> Hi..
> An abstract class is defined so as to give a generalised form which can be shared by its subclasses. Sometimes a situation may occur where in one need to define a superclass which can declare a structure for its subclasses but cannot create the meaningful implementation for a method.
> So the subclass according to its necessity extend this abstract class and use the methods decalred with its own customized implementation of the method.

Usually you are better off using interfaces; abstract classes are used in the case where you want to provide some default implementation as well.

- mfg


Sponsored Links

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