Polymorphism/overriding | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Polymorphism/overriding

is this a polymorphism or overriding code? https://code.sololearn.com/cCX7RHxF0Ee1/?ref=app

26th Oct 2017, 1:30 AM
oyl
1 Answer
+ 2
It's polymorphism and overriding (but you forgot about the @Override annotation before the method you're overriding). Polymorphism - "The dictionary definition of polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages. This principle can also be applied to object-oriented programming and languages like the Java language. Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class." https://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html Overriding - Means rewriting the code, in the subclasses, from the same method that was implemented (or not in case of abstract) in the super class.
26th Oct 2017, 6:28 AM
Chriptus13
Chriptus13 - avatar