Java · Inheritance, polymorphism and interfaces

Polymorphism: the object decides

One variable of a superclass type can hold a Dog or a Cat, and each call still runs the right animal's method.