java枚举System.getProperty(name)的返回值,,使用System.get
分享于 点击 48830 次 点评:86
java枚举System.getProperty(name)的返回值,,使用System.get
使用System.getProperties()方法,可以获得System.getProperty(O)的所有参数值的枚举,通过此枚举,我们就可以列举所有系统参数值
如下代码:
import java.util.Enumeration;import java.util.Properties;/** * * @author byrx.net */public class Main { /** * Lists the system properties */ public void listSystemProperties() { Properties prop = System.getProperties(); Enumeration enumeration = prop.keys(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); System.out.println(key + " = " + prop.getProperty(key)); } } /** * @param args the command line arguments */ public static void main(String[] args) { new Main().listSystemProperties(); }}
用户点评