1 package system; 2 /** 3 * exit(int status) 终止当前正在运行的 Java 虚拟机。 4 5 gc() 运行垃圾回收器 6 7 currentTimeMillis() 返回以毫秒为单位的当前时间。 8 9 * @author star 10 * 11 */ 12 public class SystemDemo1 { 13 14 public static void main(String[] args) { 15 // System.out.println("hello"); 16 // System.exit(0); 17 // System.out.println("world"); 18 19 20 //获取当前系统时间 21 // long time = System.currentTimeMillis(); 22 // System.out.println(time); 23 // System.out.println(Long.MAX_VALUE); 24 25 long start = System.currentTimeMillis(); 26 int sum = 0; 27 for(int i = 0;i<1000000;i++){ 28 // System.out.println("hello" + i); 29 sum += i; 30 } 31 32 long end = System.currentTimeMillis(); 33 System.out.println("共耗时: " + (end - start) + "毫秒" + sum); 34 } 35 36 }
System类的方法
猜你喜欢
转载自www.cnblogs.com/star521/p/8945786.html
今日推荐
周排行