System不能实例化(不能创建对象)
package com.itheima.d13_System;
import java.util.Arrays;
public class SystemDemo {
public static void main(String[] args) {
System.out.println("程序开始。。。");
// 这个System的方法都是共享的,所以使用用类名调用即可 exit方法中参数为0,代表人为终止
// System.exit(0); // JVM Java虚拟机终止,后面的代码都不会运行
// 2.计算机认为时间有起源:返回1970-1-1 00:00:00 走到此刻的总的毫秒值叫做:时间毫秒值
long time = System.currentTimeMillis();
System.out.println(time);
long startTime = System.currentTimeMillis();
// 运行时间的计算,性能分析
for (int i = 0; i < 100000; i++) {
System.out.println("输出:" + i);
}
long endTime = System.currentTimeMillis();
System.out.println((endTime -startTime)/1000.0 + "s");
// 3. 做数组拷贝(了解)
/**
* arraycopy(Object src, int srcPos,
* Object dest, int destPos,
* int length);
* 参数一:被拷贝的数组
* 参数二:从哪个索引位置开始拷贝
* 参数三:复制的目标数组
* 参数四:粘贴位置
* 参数五:拷贝元素的个数
*/
int[] arr1 = {10, 20, 30, 40, 50, 60, 70};
int[] arr2 = new int[6]; // [0,0,0,0,0,0] == > [0,0,40,50,60,0]
System.arraycopy(arr1,3,arr2,2,3);
System.out.println(Arrays.toString(arr2)); // 将arr2数组的字符串的内容打印出来
}
}