System类

  1. exit:退出当前程序。
  2. arraycopy:复制数组元素,比较适合底层调用,一般使用Arrays.copyOF完成复制数组。
  3. currentTimeMillens:返回当前时间距离 1970-1-1 的毫秒数。
  4. gc:运行垃圾回收机制 System.gc();
public class System_ {
    public static void main(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 = new int[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.d
        System.arraycopy(src,0,dest,1,2);
        System.out.println(Arrays.toString(dest));//[0, 1, 2]
        //currentTimeMillis:返回当前时间距离1970年01时01分的毫秒数
        System.out.println(System.currentTimeMillis());
    }
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。