注解格式
@Retention(RUNTIME)
@Target({ TYPE, FIELD, METHOD })
public @interface LinAnnotation {
}
注解类不能被继承(反编译注解类的时候,发现注解类继承Annotation类,java不支持多继承)。
@Inherited 可以让注解被继承,但这并不是真的继承,只是通过使用@Inherited,可以让子类Class对象使用getAnnotations()获取父类被@Inherited修饰的注解。
注解