System类不能被实例化
主要方法:currentTimeMillis() 用于计算程序执行的时间
exit(); 退出虚拟机
gc(); 垃圾回收
public static void main(String[] args) {
//用于计算程序执行的时间
long t=System.currentTimeMillis();
System.out.println(t);
for(int i=0;i<100000;i++){
System.out.println(i);
}
long end=System.currentTimeMillis();
System.out.println(end-t);
fun();
}
public static void fun(){
new Person();
new Person();
new Person();
new Person();
new Person();
new Person();
new Person();
new Person();
System.gc();
}
package cn.lijun.demo2;
public class Person {
public void finalize(){
System.out.println("垃圾被收走了");
}
}