public class Test {
public static void main(String[] args) {
int[] arr = new int[]{1, 2, 3, 4, 5, 6};
printArr(arr);
arr = deleteFirst(arr);
printArr(arr);
}
static void printArr(int[] arr) {
for (int i : arr) {
System.out.print(i + " ");
}
System.out.println();
}
static int[] deleteFirst(int[] arr) {
int[] temp = new int[arr.length - 1];
System.arraycopy(arr, 1, temp, 0, temp.length);
return temp;
}
}
标签:arr,java,删除,temp,int,printArr,System,static,数组 From: https://www.cnblogs.com/mask-xiexie/p/16877639.html