Use of an abstract class without any abstract methods

abstract, abstract-class, java

Solution

The principal role of an abstract class is to provide an appropriate root class from which concrete, (i.e. non-abstract) subclasses can be derived. This is a powerful and versatile feature which promotes code re-use. Abstract classes encapsulate general features that are common to a range of data types - features which are too general to be meaningful in the abstract class, but which can be overridden in a subclass

Any class with an abstract method is automatically abstract itself and must define itself as such with the keyword abstract - interestingly, an abstract class need not contain any abstract methods

An abstract class cannot be instantiated - in other words you cannot create instances (objects) of an abstract class

References to objects of an abstract class can be declared even though objects of abstract classes cannot be instantiated, e.g Account a ; will not generate a syntax error

If a subclass of an abstract class overrides, i.e. provides an implementation of every abstract method in its superclass, the subclass is called a concrete class and objects of the subclass can be created

If a subclass of an abstract class does not override (implement) all of the abstract methods it inherits, that subclass itself is also abstract and must be declared as such

Problem

An abstract class need not include any abstract methods. Is there any other reason to make a class abstract other than the fact that abstract classes can't be instantiated?

Original source

Related problems