//System类
import java.util.Date;
import java.util.Properties;
public class test26 {public static void main(String[] args){testOut(-1);//获取系统时间long sysTime=System.currentTimeMillis();System.out.println(sysTime);Date date=new Date();System.out.println(date.toLocaleString());//垃圾回收器回收System.gc();//获取属性值Properties map=System.getProperties();System.out.println(map);}public static void testOut(int age){if(age<0){System.err.println("年龄不能是负数");}else {System.out.println("年龄是合法的");}}
}
运行结果