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. 

16.1   Setup Classes Using Inheritance to Demonstrate Polymorphism

 
 
 

16.2   Define Objects Using Polymorphism

 
 
 
 

16.3   What Does it Mean to Upcast and Downcast objects

 
 

16.4   How the JVM Chooses the Correct Method to Execute

 
 

16.5   Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage