Create your account

Already have an account? Login here

Note: By joining, you will receive periodic emails from Coursetro. You can unsubscribe from these emails.

Create account

73. Polymorphism With Classes Example

Getting Started with Java

Woah, wait a second..

This is a 100% free course, but we need you to first join or login to watch this video.

Alright, join or login here.

This video shows an example of polymorphism or dynamic method dispatch in Java. We have a base class called Shape with several subclasses such as Square, Circle, Rectangle, Triangle and they all override the base method getArea() to define how each of their areas are calculated. The main program asks the user to enter the side lengths for a bunch of different shapes and then calculates the minimum, maximum and average area using polymorphism.

Course Cirriculum