Java ClassesLesson 35Free preview
Java Polymorphism
This lesson is part of Java · All levels
Summary
Polymorphism means that a single form can appear in many forms, for example a method name with different behavior depending on the object. In Java there is polymorphism during compilation (overloading) and during runtime (overriding). This concept makes the program flexible because it can handle many types of objects through one common type.
Key points
- Overloading: the same method with different parameters, determined when compilation
- Overriding: method of the child overriding the parent method with the same signature, determined at runtime
- A superclass reference can point to a subclass object.
- Polymorphism facilitates the addition of new species without changing the old code
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.