Object-oriented programming for Java - 4

Java Abstract (Class & Methods)

 


1. Java Abstract Class

The abstract class in Java cannot be instantiated (we cannot create objects of abstract classes)

 

2. Java Abstract Method

Though abstract classes cannot be instantiated, we can create subclasses from it. We can then access members of the abstract class using the object of the subclass.

Program calling the method of the abstract class using the object obj (which is the object of the child class Main)

 

3. Implementing Abstract Methods

If the abstract class includes any abstract method, then all the child classes inherited from the abstract superclass must provide the implementation of the abstract method

 

4. Java Abstraction