Name
Override
Synopsis
An
annotation of this type may be applied to methods and indicates that
the programmer intends for the method to override a method from a
superclass. In effect, it is an assertion for the compiler to verify.
If a method annotated
@Override
does
not, in fact, override another method (perhaps because the method
name was misspelled or an argument was incorrectly typed), the
compiler issues an error. This annotation type has source retention.
Figure 10-50. java.lang.Override
public @interface Override {
}
Get Java in a Nutshell, 5th Edition 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.