☰ See All Chapters |
Java class vs. abstract class
In this chapter you learn the differences between java class and abstract class.
Class | Abstract Class |
A class can contain the following members:
| Abstract class can contain the following members:
|
It is used for doing new concrete implementation. | It is used for doing partial implementation. |
We can create objects for class using new keyword. class A { }
class B { A a = new A(); } | We cannot create objects for abstract class. Creating objects for abstract class results into compilation error. |
Class can be made final. final class A { } | Abstract class cannot be declared as final. It results into compilation error. final abstract class B { // not possible } |
It does not support dynamic polymorphism. | It supports dynamic polymorphism. |
All Chapters