System
package com.mao.one; public class SystemDemo01 { public static void main(String[] args) { //方法的形参 //状态码: //0:代表虚拟机正常停止 //非0:(常用1) 表示虚拟机异常停止 // System.exit(0); // long l = System.currentTimeMillis(); // System.out.println(l); //拷贝数组 int[] arr1 = {1,2,3,4,5,6,7,8,9,0}; int[] arr2 = new int[10]; //将arr1中的数拷贝到arr2 //参数一:数据源,要拷贝的数据是从哪个数组来的 //参数二:从数组源数组中第几个索引开始拷贝 //参数三:数据的目的数组 //参数四:目的数组的索引 //参数五:拷贝几个数 System.arraycopy(arr1,0,arr2,0,10); for (int i = 0; i < arr2.length; i++) { System.out.println(arr2[i]); } //练习 //arr2:0 0 0 0 1 2 3 0 0 0 //Sysrtem.arraycopy(arr1,0,arr2,4,3) //arr2:0 0 7 8 9 0 0 0 0 0 //Sysrtem.arraycopy(arr1,6,arr2,2,3) } }

浙公网安备 33010602011771号