Following are the important differences between an abstract class and a concrete class.
Sr. No. | Key | Abstract Class | Concrete Class |
---|---|---|---|
1 | Supported Methods | Both 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. |
2 | Instantiation | The new keyword cannot be used to create an abstract class. | The concrete class can be instantiated using the new keyword. |
3 | Abstract method | Abstract methods may or may not exist in abstract classes. | There can’t be an abstract method for the concrete class. |
4 | Final | A final class cannot be declared for an abstract class. | It is possible to declare a concrete class to be final. |
5 | Keyword | The abstract keyword is used to declare a class. | The abstract keyword is not present in the declaration of a concrete class. |
6 | Inheritance | The extends keyword allows an abstract class to inherit another class and implement an interface. | Only an interface can be inherited by an interface. |
7 | Interface | An 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
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
Staying up to the mark is what defines me. Hi all! I’m Rabecca Fatima a keen learner, great enthusiast, ready to take new challenges as stepping stones towards flying colors.
You are given a stream of elements that is too large to fit into memory.…
The formula for the area of a circle is given by πr². Use the Monte…
Given an integer k and a string s, write a function to determine the length…
There is a staircase with N steps, and you can ascend either 1 step or…
Build an autocomplete system that, given a query string s and a set of possible…
Design a job scheduler that accepts a function f and an integer n. The scheduler…