annotation事实上就是一个interface
下面举一个例子
package annotation.inherit;
public @interface DefinedAnnotation {
}
将其class文件反编译之后
package annotation.inherit;
import java.lang.annotation.Annotation;
public interface DefinedAnnotation
extends Annotation
{
}
你会发现事实上他就是一个实现了Annotation接口的interface
浙公网安备 33010602011771号