Java Programming/Keywords/abstract
From Wikibooks, the open-content textbooks collection
abstract is a Java keyword.
It declares a class abstract, not all its methods are defined/implemented. Objects cannot be created from an abstract class. It needs to have a non abstract subclass in order to create an object.
It also declares a method abstract, that is, not implemented in the abstract class. A method cannot be declared abstract in a non abstract class.
Syntact:
publicabstractClassName orabstractpublicClassName and for methods in an abstract class :publicabstractvoid methodName(); // --- No body, no implementation --- orabstractpublicvoid methodName(); // --- No body, no implementation ---
For Example:
publicabstractClassName { // --- This method does not have a body; it is abstract. ---publicabstractvoidabstractMethod(); // --- This method does have a body; it is implemented in the abstract class; gives a default behavior. ---publicvoidnormalMethod() { ... } }