This isn't quite true. An abstract class does not have to have any abstract methods.
Originally posted by Scott Appleton:
An abstract class can declare variables, too. It can also provide implementations of some methods; it is abstract only because at least one method is declared but not implemented.
There is another reason. It may be that each method has a default implementation but that no class that extends the abstract class would leave all the methods as their default. A class like MouseAdapter could have been made abstract because no one would ever instantiate a MouseAdapter because it doesn't do anything (all the methods are empty). In fact, it is abstract although it has no abstract methods!!!
A class type should be declared abstract only if the intent is that subclasses can be created to complete the implementation. If the intent is simply to prevent instantiation of a class, the proper way to express this is to declare a constructor (�8.8.8) of no arguments, make it private, never invoke it, and declare no other constructors.
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton