Abstract Class In Java

Abstract Class In Java :

  • A class which is declared with the abstract keyword is known as an abstract class in Java. It contain the abstract and non – abstract methods (method with the body).  It needs to be extended and its method implemented. It cannot be instantiated.

  • All functions in java by default virtual.


  • Abstraction is a process of hiding the implementation details and showing only functionality to the user.

  • Concrete methods:Regular methods with body.

  • Abstract class: Cannot create object but they can be subclasses. To access it, it must be inherited from another class. Abstract class at least one abstract method.  An abstract class is a class that is declared abstract.

  • Abstract classes can have contains Constructors, Member variables, Instance member and Normal methods. Constructor of the abstract class will be used to instantiate the abstract class instance variable.

  • Abstract class can implement interfaces without even providing the implementation of interface methods.

  • Abstract class is used to provide common method implementation to all the subclasses or to provide default implementation.

  • A class cannot be both ‘abstract’ & ‘final’.

  • We cannot make an inner class as abstract.

  • We cannot use static method but can use static variable in the abstract class.

  • If we don’t want to override abstract in its sub-class then declare that sub-class as abstract.

  • Overridden abstract class methods will be accessed by its sub-class object.

  • Abstract method: Only be used in an abstract class, and it does not have a body. The body is provided by the subclass.

  • If you inherit an abstract class, you have to provide implementations to all the abstract methods in it.

  • An abstract method has no implementation. It just has a method signature. 

  • Abstract method can never be final and static. 

  • Any subclass that extends an abstract class must implement all the abstract methods declared by the super class. All the abstract methods must be overridden.

  • When you extend abstract class with abstract method, you must define the abstract method in the child class, or make the child class abstract.

  • It can have final methods which will force the subclass not to change the body of the method.

For example:

  1. Every ATM card common functionality cash debit but password is different.
  2. Any person all different attributes name, age and working area.