Enumeration and Properties

package com.Java程序设计入门.datastructure;

import java.util.Properties;
import java.util.Enumeration;

public class EnumerationPropertiesTest {
    public static void main(String[] args) {
        Properties systemProperties = System.getProperties();
        Enumeration enumeration = systemProperties.propertyNames();
        while(enumeration.hasMoreElements())
        {
            String key = (String) enumeration.nextElement();
            String property = systemProperties.getProperty(key);
            System.out.println(key+"="+property);
        }
        
    }
}

结果:

 

------------------------

java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=C:\Program Files\Java\jre1.8.0_201\bin
java.vm.version=25.201-b09
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg=sun.io
user.script=
user.country=CN
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=Service Pack 1
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\EclipseSpaceJava程序入门设计\practice
java.runtime.version=1.8.0_201-b09
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\Program Files\Java\jre1.8.0_201\lib\endorsed
........

posted @ 2019-05-01 20:02  allenbackpacker  阅读(107)  评论(0编辑  收藏  举报