import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.Field;
public class Test {
public static void main(String[] args) throws Exception{
Class clazz= Class.forName("com.zy.test.MyDemo");
myAnn as= (myAnn) clazz.getAnnotation(myAnn.class);
System.out.println(as.value());
System.out.println(as.name());
}
}
@myAnn(value = "aaa", name = "mydemo")
class MyDemo {
}
//
@Retention(RetentionPolicy.SOURCE)
@interface myAnn {
String value();
String name();
}