java代码=--数组复制

总结:arraycopy注意数组定义的长度。不足会补0

package clientFrame;

//数组的复制arraycopy()
public class Xiang {
	public static void main(String[] args) {
		int a[] = new int[] { 2, 3, 4, 6, 7 };
		int b[] = new int[3];// 位数
		System.arraycopy(a, 0, b, 0, 3);
		for (int i = 0; i < b.length; i++) {
			System.out.print(b[i] + " ");
		}

	}
}


2 3 4 

  

原文地址:https://www.cnblogs.com/langlove/p/3458734.html