出现异常怎么回事?
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 72
at com.imooc.oneji.A0002.ccc(A0002.java:12)
at com.imooc.oneji.saeag.main(saeag.java:15)
程序都没问题啊?
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 72
at com.imooc.oneji.A0002.ccc(A0002.java:12)
at com.imooc.oneji.saeag.main(saeag.java:15)
程序都没问题啊?
2016-04-08
import java.lang.reflect.Method;
public class A0002 {
public static void ccc(Object obj) {
Class a1=obj.getClass();
System.out.println(a1.getName());
Method[] ms=a1.getMethods();
for(int i=0;i<=ms.length;i++){
Class returnType=ms[i].getReturnType();
System.out.print(returnType.getName()+"(");
System.out.print(ms[i].getName());
Class[] gag=ms[i].getParameterTypes();
for (Class caa : gag) {
System.out.print(caa.getName()+",");
}
System.out.println(")");
}
}
}
大神请验收下
举报