- Annotations is the nature of the interface can be verified by the following code:
public class Test { public static void main(String[] args) { Class clazz=Anno02.class; System.out.println("是否是接口"); System.out.println(clazz.isInterface());//true System.out.println("===========继承那个接口============="); Class[] cs=clazz.getInterfaces(); for (Class class1 : cs) { System.out.println(class1);// java.lang.annotation.Annotation } the System. OUT .println ( " ========== ============ Method " ); / * * * See reflection time the method is to annotation property: * abstract public java.lang.String cn.edu.xcu.annotation.v2.Anno02.m () * / method, [] MS = clazz.getMethods (); for (method, method: MS) { . the System OUT .println (Method); } . the System OUT .println ( " ========== field ============ " ); field, [] FS =clazz.getFields(); for (Field field : fs) { System.out.println(field); } } }