Abstract Classes and Methods

Abstract methods

A method with the keyword abstract in its declaration is known as an abstract method.

Rules to be followed

  • In contrast to a concrete/normal Java method an abstract method does not have a body/definition i.e. it only has a declaration or method signature inside an abstract class or an interface.

  • An abstract method can be declared inside an abstract class or an interface only.

  • In other words, it can be said that to contain any abstract method in its implementation a class has to be declared as an abstract class because non-abstract classes cannot have abstract methods.

  • An abstract method cannot be declared private as it has to be implemented in some other class.


Now moving on to the syntax part, syntactically, the generalized declaration of an abstract method is as follows:

Get hands-on with 1200+ tech skills courses.