Polymorphism
Polymorphism allows objects to take many forms. It includes method overriding and overloading.
class Animal {
void speak() {
System.out.println("Animal speaks");
}
}
class Cat extends Animal {
void speak() {
System.out.println("Cat meows");
}
}
At runtime, the JVM decides which method to call depending on the object type.