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{

}
}

posted @ 2013-08-26 18:14  prison  阅读(214)  评论(0编辑  收藏  举报