import java.lang.reflect.Method;
import java.util.ArrayList;
public class show {
public static void main(String[] args) throws Exception, SecurityException {
ArrayList<Integer> al =new ArrayList<Integer>();
Class c =al.getClass();
Method m =c.getMethod("add",c.getClasses());
m.invoke(al,"abc");
System.out.println(al);
}
} 运行的时候 “m.invoke(al,"abc");”这行报错了,求大神指教
|
|