在书上看到一个小程序,运行之后能看到系统的一些属性,主要还是system的一些方法运用,分享给大家:
代码:
public class SystemProperties {
public static void main(String[] args) {
String jreVersion = System.getProperty("java.version");
String operationSystem = System.getProperty("os.name");
String userHome = System.getProperty("user.home");
System.out.println("JER版本:"+jreVersion);
System.out.println("操作系统名:"+operationSystem);
System.out.println("用户名:"+userHome);
}
}