黑马程序员技术交流社区

标题: 关于反射的代码,为什么最后两行会报错 [打印本页]

作者: mmakun    时间: 2015-5-29 18:13
标题: 关于反射的代码,为什么最后两行会报错

  1.         public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
  2.                 // TODO Auto-generated method stub
  3.                 //Method aMethod=a.class.getMethod("main", String[].class);
  4.                
  5.                 //aMethod.invoke(null, (Object)new String[]{"11"});
  6.                
  7.                 int[] a1=new int[3];
  8.                 int[] a2=new int[]{2,5,3,6};
  9.                 String[] a3=new String[4];
  10.                 int[][] a4=new int[3][4];
  11.                 System.out.println(a1.getClass()==a2.getClass());
  12.                 System.out.println(a1.getClass()==a3.getClass());
  13.                 System.out.println(a3.getClass()==a4.getClass());
  14.                
  15.                
  16.                
  17.         }

  18. }
复制代码


为什么最后 两行会报错,百思不得解
作者: cyaimyt    时间: 2015-6-4 07:55
我看看先




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2