System.arraycopy(arr,0,arr2D[0],0,20);

解决方案 »

  1.   

    不能使用arraycopy,因为类型不符如果arr2D 是 int[] ,就可以了
      

  2.   

    arrcopy(int[] arr,int[][] arr2d)

    for(int i=0;i<arr.length;i++)
    {
    if(i<arr2d[0].length) arr2d[0][i]=arr[i];
    }
    }arrcopy(arr,arr2d);//对arrcopy的调用
      

  3.   

    System.arraycopy(arr,0,arr2D[0],0,20);
    会抛出 ArrayStoreException
    ArrayStoreException - if an element in the src array could not be stored into the dest array because of a type mismatch.
      

  4.   

    to hexiaofeng(java爱好者)我没有测试过上面的代码,我那样子写是以为
    int arr2D=new int[20][20];
    那么arr2D[0]就是int[]型的,他和int arr[]=new int[20]类型应该是一样的.