java注解问题

注解在接口中的方法,子类中不能查找到方法的注解

public class AnnotationTest implements A {

public static void main(String[] args) {
Method[] ms = A.class.getDeclaredMethods();
System.out.println(ms[1].getName()+" : "+ms[1].isAnnotationPresent(Annotation.class));
}

public void a() {
}
public void b() {
}

}

interface A{

void a();
@Annotation
void b();
}

class AnnotationDemo {
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Annotation{

}
}

原文地址:https://www.cnblogs.com/xuzhenmin/p/3283203.html