1987WEB视界-分享互联网热点话题和事件

您现在的位置是:首页 > WEB开发 > 正文

WEB开发

System

1987web2024-03-27WEB开发192
System类exit:退出当前程序。arraycopy:复制数组元素,比较适合底层调用,一般使用Arrays.copyOF完成复制数组。

System类

exit:退出当前程序。arraycopy:复制数组元素,比较适合底层调用,一般使用Arrays.copyOF完成复制数组。currentTimeMillens:返回当前时间距离 1970-1-1 的毫秒数。gc:运行垃圾回收机制 System.gc();publicclassSystem_{publicstaticvoidmain(String[]args){// //exit: 退出当前程序// System.out.println("ok1");// //1. exit(0) 表示程序正常退出// //2. 0 表示一个状态,正常状态// System.exit(0);// System.out.println("ok2");//arraycopy : 复制数组元素,比较适合底层调用//一般使用Arrays.copyOf 完成复制数组int[]src={1,2,3};int[]dest=newint[3];// dest 当前是 {0,0,0}//1. 主要是搞清楚这五个参数的含义//2.// 原数组// * @param src the source array.// srcPos:从原数组的哪个索引位置开始拷贝// * @param srcPos starting position in the source array.// dest:目标数组,即把原数组的数组拷贝到这个数组// * @param dest the destination array.// destPos:把原数组的数据拷贝到目标数组的哪个索引开始// * @param destPos starting position in the destination data.// length:从原数组拷贝多少数据到目标数组// * @param length the number of array elements to be copie.dSystem.arraycopy(src,0,dest,1,2);System.out.println(Arrays.toString(dest));//[0, 1, 2]//currentTimeMillis:返回当前时间距离1970年01时01分的毫秒数System.out.println(System.currentTimeMillis());}}
声明:本站所有文章,如无特殊说明或标注,均为爬虫抓取以及网友投稿,版权归原作者所有。