annotation事实上就是一个interface
下面举一个例子
package annotation.inherit;
public @interface DefinedAnnotation {
}
将其class文件反编译之后
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: DefinedAnnotation.java
package annotation.inherit;
import java.lang.annotation.Annotation;
public interface DefinedAnnotation
extends Annotation
{
}
你会发现事实上他就是一个interface
浙公网安备 33010602011771号