From the course: Object-Oriented Programming with Java

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

What is polymorphism?

What is polymorphism?

- [Instructor] It's time to introduce you to one of my favorite words in object-oriented programming: Polymorphism. The poly part of the word in Latin means many, and morph means form, so polymorphism means many forms. There are two kinds of polymorphism in Java: Static polymorphism is implemented in Java as method overloading, where you have the same method name but different arguments. I'm looking at the Java doc for the Java 9 version of the list class. To get here, I did a Google search for "Java 9 list." Java 8 has different methods and features. Here I'm looking at some overloaded methods. They all have the same name, but you can see they have different numbers of elements they can take. But they kind of do the same thing. They're all returning an immutable list, just depends on the number of elements. That's method overloading. Static polymorphism. It's called static because at compile time, you can see which one…

Contents