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); } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!