对反射不太理解,希望高手讲解一下。尤其是一下这段对接收数组参数的成员方法进行反射的代码:- String mainClassName=new String("MainClassName");
- Method mainMethod=Class.forName(mainClassName).getMethod("main", String[].class);
- mainMethod.invoke(null, new Object[]{new String[]{"Ling","Dong","Cao"}});
- mainMethod.invoke(null, (Object)new String[]{"Ling","Dong","Cao"});
复制代码 |