可能编译不过去,改一改。手写的!
public class A{
public static void main(String[] args){
Class c = Class.forName("B");
Object o = c.newInstance();
Method m = c.getMethod("add",new int[].class);
m.invoke(o,new int[]{1,2});
}
}
class B{
public void add(int... a){
system.out.println("ddd");
}
}