Is polymorphism also applied in abstract classes?

The general argument is that polymorphism applies only to interfaces, and not to abstract classes.

Is the relation as an abstract parent class to a specific class that extends it considered polymorphism?

List list = new Arraylist()// Polymorphism as List is an interface AbstractClass parent = new Child(); // Is this also considered polymorphic? 
-3
java oop
source share
2 answers

Yes. It is polymorphic ........

+2
source share

General argument - Polymorphism applies only to Code to Interface and Not abstract.

This "argument" is actually incorrect.

Polymorphism works fine in Java, whether you use interfaces, abstract classes, or non-abstract classes. (There are questions that are best suited for long-term maintainability, but that's another topic.)


I would be curious where you found this "argument". Can you provide a URL?

+2
source share

All Articles