package base.taxt;
import java.util.Arrays;
public class array {
public static void main(String[] args) {
//数组复制:使用System.arraycopy()
// 下面是复制数组的原理。
int[] scores1 = {88, 81, 74, 22, 11};
int[] scores2 = new int[scores1.length];
for(int i =0; i<scores1.length; i++){
scores2[i]=scores1[i];
System.out.printf("%3d",scores2[i]);
}
//下面是数组复制的快捷键 Arrays.copyOf(数组,数组长度),
// 打印数组:Arrays.toString(数组名)
System.out.println();
int[] scores3= Arrays.copyOf(scores1,scores1.length+1);
System.out.println(Arrays.toString(scores3));
}
}