欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

java枚举System.getProperty(name)的返回值,,使用System.get

来源: javaer 分享于  点击 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();    }}
相关栏目:

用户点评