annotation本质

annotation事实上就是一个interface

下面举一个例子

package annotation.inherit;
 

public @interface DefinedAnnotation {
 
}

将其class文件反编译之后
 
package annotation.inherit;
 

import java.lang.annotation.Annotation;
 

public interface DefinedAnnotation
 extends Annotation
{
}
 

你会发现事实上他就是一个实现了Annotation接口的interface
原文地址:https://www.cnblogs.com/silentjesse/p/2084774.html