Categories: Java

Abstract class vs Concrete class

Following are the important differences between an abstract class and a concrete class.

Sr. No.KeyAbstract ClassConcrete Class
1Supported MethodsBoth abstract and concrete methods can be found in an abstract class.Only concrete methods are allowed in a concrete class. The class is abstract, even if it only has one abstract method.
2InstantiationThe new keyword cannot be used to create an abstract class.The concrete class can be instantiated using the new keyword.
3Abstract methodAbstract methods may or may not exist in abstract classes.There can’t be an abstract method for the concrete class.
4FinalA final class cannot be declared for an abstract class.It is possible to declare a concrete class to be final.
5KeywordThe abstract keyword is used to declare a class.The abstract keyword is not present in the declaration of a concrete class.
6InheritanceThe extends keyword allows an abstract class to inherit another class and implement an interface.Only an interface can be inherited by an interface.
7InterfaceAn interface cannot be implemented solely by an abstract class. To be able to use the interface for instantiation, a child class is required.It is simple to create an interface.

Note: also read about the Regular class vs static nested class

Follow Me

If you like my post, please follow me to read my latest post on programming and technology.

https://www.instagram.com/coderz.py/

https://www.facebook.com/coderz.py

Share
Published by
Rabecca Fatima

Recent Posts

Generate Parenthesis | Intuition + Code | Recursion Tree | Backtracking | Java

Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…

3 months ago

Square Root of Integer

Given an integer A. Compute and return the square root of A. If A is…

1 year ago

Build Array From Permutation

Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…

1 year ago

DSA: Heap

A heap is a specialized tree-based data structure that satisfies the heap property. It is…

2 years ago

DSA: Trie

What is a Trie in DSA? A trie, often known as a prefix tree, is…

2 years ago

Trees: Lowest Common Ancestor

What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…

2 years ago