Differences between abstract class and concrete class in Java


In Java, abstraction is achieved using Abstract classes and interfaces. An abstract class contains abstract methods which a child class. Following are the important differences between abstract class and a concrete class.

Sr. No. Key Abstract Class Concrete Class
1 Supported Methods Abstract class can have both an abstract as well as concrete methods. A concrete class can only have concrete methods. Even a single abstract method makes the class abstract.
2 Instantiation Abstract class can not be instantiated using new keyword. Concrete class can be instantiated using new keyword.
3 Abstract Method Abstract class may or may not have abstract methods. Concrete clas can not have an abstract method.
4 Final Abstract class can not be declared as a final class. Concrete class can be declared final.
5 Keyword Abstract class declared using abstract keyword. Concrete class is not having abstract keyword during declaration.
6 Inheritance Abstract class can inherit another class using extends keyword and implement an interface. Interface can inherit only an inteface.
7 Interface Abstract class can not implement an interface alone. A child class is needed to be able to use the interface for instantiation. Interface can be implemented easily.

Example of Abstract Class vs Concrete Class

public class JavaTester {
   public static void main(String args[]) {
      Cat lion = new Lion();
      lion.eat();
   }
}
abstract class Cat {
   abstract public void eat();
}
class Lion extends Cat{
   public void eat(){
      System.out.println("Lion eats");
   }
}

Output

Lion eats 

Updated on: 08-Dec-2023

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements