Method Overriding

Providing a subclass version of an inherited instance method.

What is Method Overriding in Java?

Method Overriding — Providing a subclass version of an inherited instance method.

class Alert {
    String text() {
        return "Alert";
    }
}

class EmailAlert extends Alert {
    @Override
    String text() {
        return "Email";
    }
}

Level: Journeyman · More Java terms at this level

Updated

In other subjects