Override in Java

java.lang.Override

Indicates that a method declaration is intended to override a method declaration in a super type.

If a method is annotated with this annotation type compilers are required to generate an error message unless at least one of the following conditions hold:

1. The method does override or implement a method declared in a supertype.

2. The method has a signature that is override-equivalent to that of any public method declared in the Object.

Declaration

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Override {
}


No comments:

Post a Comment