为什么下面的代码运行有错误码呢?我觉得这样写没错啊,最后是报这个错:
public class Test6 {
public static void main(String[] args) throws Exception{
Class clazz = Person.class;
Person bean = (Person)clazz.newInstance();
Method method = clazz.getMethod("Person",String.class,int.class);
method.invoke(bean, "wangwu",20);
System.out.println(bean.getAge());
}
}
|