16 Polymorphism In Action
After reading lesson 16, you will be able to:
- Define objects using polymorphism
- Use upcasting and downcasting with objects
- Describe how the virtual machine chooses the correct method when a subclass overrides a superclass method
This lesson shows examples of polymorphism in Java. As I stated previously, there are two types of polymorphism. Method overloading (Lesson 13) is an example of static polymorphism and it occurs at compile time. Method overriding (Lesson 14) is considered dynamic binding and it occurs at run-time.