EMZETT.
Login

Override

In short: Overriding means re-implementing an inherited method in a subclass.

In more detail: Name, parameters and return type stay the same, the logic changes. Which version runs is decided at runtime by the object’s type (polymorphism).

In Depth

class Animal { void sound() { System.out.println("..."); } }
class Dog extends Animal {
    @Override void sound() { System.out.println("Woof"); }
}

Distinction: with overloading the same method name in one class has different parameters. See @Override, inheritance, final.

See also: @Override, Inheritance, extends, final