Polymorphism

image

Polymorphism is a complicated name for a straightfoward concept. It is Greek for “many shapes,” and it means allowing the same code to be used with different types. In Java, it is implemented by allowing several different methods to have the same name, making it look like one method to the API user. “Name reuse” would be a better term. There are two types of polymorphism in Java: the really easy kind (overloading) and the interesting kind (overriding).

Overloading

The really easy kind of polymorphism is called overloading in Java and other languages, and it means that in any class you can use the same name for several different ...

Get Just Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.