执行本类不带参的方法
PropertiesUtil pu = new PropertiesUtil();
pu.loadProperties("/Menu.properties");
String methodName = pu.getValue(select);
Method method = this.getClass().getMethod(methodName, null);
method.invoke(this, null);
执行本类带参的方法
PropertiesUtil pu = new PropertiesUtil();
pu.loadProperties("/Menu.properties");
String methodName = pu.getValue(select);
Method method = this.getClass().getMethod(methodName, String.class);
method.invoke(this, "Tom");
执行其他类方法
LotteryManager lm=new LotteryManager();
Method method=LotteryManager.class.getMethod(methodName,String.class);
method.invoke(lm,"Jhone");