Team LiB
Previous Section Next Section

Overridejava.lang

Java 5.0@Target(METHOD) @Retention(SOURCE) annotation

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 {
}

    Team LiB
    Previous Section Next Section