Abstract class in Java

A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated. Following are the few points which needs to be pondered while practicing abstraction.

  1. An abstract class must be declared with an abstract keyword.
  2. It can have abstract and non-abstract methods.
  3. It cannot be instantiated.
  4. It can have constructors and static methods also.
  5. It can have final methods which will force the subclass not to change the body of the method.

Syntax of abstract class

lstlisting abstract class A