Method me=Class.forName(str).getMethod("main",String[].class);//这里第二个参数是String数组;
me.invoke(null,(Object)new String[]{"wo","ai","zhonghua"});//你传入String数组的话,jdk1.5新特性,可变参数原理,会将你的new String[]{"wo","ai","zhonghua"拆成3个String,造成参数错误找不到该方法;
所以转成Object是为了不让jdk把你的数组当成可变参数给拆开; |