设为首页 加入收藏

TOP

System
2023-07-25 21:43:01 】 浏览:30
Tags:System

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());
    }
}
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇《RPC实战与核心原理》学习笔记Da.. 下一篇财务精度:BigInteger 与 BigDeci..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目