一下是java给出的源代码:
/* * @(#)Override.java1.6 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */
package java.lang;
import java.lang.annotation.*;
/** * Indicates that a method declaration is intended to override a * method declaration in a superclass. If a method is annotated with * this annotation type but does not override a superclass method, * compilers are required to generate an error message. * * @author Joshua Bloch * @since 1.5 */@Target(ElementType.METHOD)@Retention(RetentionPolicy.SOURCE)public @interface Override {}
以上实际只有一句是有用的即:
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Override {}
但从此源代码来看,似乎什么都没实现,那么从哪里看出此注解是声明覆盖父类的方法呢?还望各位不吝赐教,谢谢!