@Pro(className = "com.test.annotation.Student",methodName = "study")
public class ReflectTest {
public static void main(String[] args) throws Exception {
//1.解析注解
//获取该类的字节码对象
Class<ReflectTest> **reflectTestClass** = ReflectTest.class;
//获取上面的注解对象
Pro pro = reflectTestClass.getAnnotation(Pro.class);//其实就是在内存中生成了一个该注解接口的子类实现对象
//调用注解对象中定义的抽象方法,获取返回值
String className = pro.className();
String methodName = pro.methodName();
Class **cls** = Class.forName(className);
Object obj = cls.newInstance();
Method method = cls.getMethod(methodName);
method.invoke(obj);
}
}