第二步:写反射程序
class ReflectTool {
public void method() {
//读取这个txt文件
InputStream is = ReflectTool .class.getResourceAsStream("config.txt");
Properties prop = new Properties(is);
String className = prop.get("className");
String methodName = prop.get("methodName");
//反射操作
Class cls = Class.forName(className());
//创建对象
Constroctor c = cls.getConstrutor();
//获取Method对象
Method m = cls.getMethod(methodName);
m .invoke(c.newInstance());
//完毕