标签:length ++ [] tar lan except str exce 目的
数组越界
public class TestArrayCopy1
{
public static void main(String[] args)
{
int ia [] = new int[]{1, 2, 3, 4, 5};
int ib [] = new int[]{9, 8, 7, 6, 5, 4, 3};
System.arraycopy(ia, 0, ib, ib.length-ia.length, ia.length);
//复制源数组中从下标0开始的ia.length个元素到目的数组,从下标ib.length-ia.length的位置开始存储
for(int i=0; i<ia.length; i++)
{
System.out.print(ia[i]);
}
System.out.println();
for(int i=0; i<ib.length; i++)
{
System.out.print(ib[i]);
}
System.out.println();
}
}
~
java.lang.ArrayIndexOutOfBoundsException
标签:length ++ [] tar lan except str exce 目的
原文地址:http://www.cnblogs.com/ilyou2049/p/6747404.html