Abstract Class

What Does Abstract Class Mean?

An abstract class, in the context of Java, is a superclass that cannot be instantiated and is used to state or define general characteristics. An object cannot be formed from a Java abstract class; trying to instantiate an abstract class only produces a compiler error. The abstract class is declared using the keyword abstract.

Subclasses extended from an abstract class have all the abstract class's attributes, in addition to attributes specific to each subclass. The abstract class states the class characteristics and methods for implementation, thus defining a whole interface.


Techopedia Explains Abstract Class

Abstract classes serve as templates for their subclasses. For example, the abstract class Tree and subclass, Banyan_Tree, has all the characteristics of a tree as well as characteristics that are specific to the banyan tree.

Understanding the differences between an abstract class and an interface is essential. An interface only has method declarations or abstract methods and constant data members, while an abstract class may have abstract methods, member variables and concrete methods. Because Java only supports single inheritance, a class can implement several interfaces but can extend only one abstract class.


Share this Term

  • Facebook
  • LinkedIn
  • Twitter

Related Reading


Software DevelopmentProgramming LanguagesDevOps

Trending Articles

Go back to top