java学习日记20230408-System类

System类

  • exit退出当前程序;
  • arraycopy:复制数组,比较适合底层调用,一般使用Arrays.copyOf完成复制数组;
  • currentTimeMillens:返回当前时间距离1970-1-1的毫秒数
  • gc运行垃圾回收机制

  

复制代码
public class SystemMethod {
    public static void main(String[] args) {
        //0 表示退出状态  正常退出
        //System.exit(0);

        System.out.println("1");

        //arraycopy
        int[] src = {1,2,3};
        int[] dest = new int[3];
        /**
         * arams:
         * src – the source array.
         * srcPos – starting position in the source array.从源数组哪个索引开始拷贝
         * dest – the destination array.
         * destPos – starting position in the destination data.把源数组的数据拷贝到目标数组的哪个索引
         * length – the number of array elements to be copied.从源数组拷贝多少个数据到目标数组
         */
        System.arraycopy(src,1,dest,0,2);
        System.out.println(Arrays.toString(dest));
        long second = System.currentTimeMillis();
        System.out.println(second);
    }
}
复制代码

 

posted @   、子夜  阅读(11)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示