System.getProperties
This commit is contained in:
parent
fe9964116e
commit
730e6a8592
17
src/chapter5/Example12.java
Normal file
17
src/chapter5/Example12.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package chapter5;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class Example12 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// 获取当前系统信息
|
||||||
|
Properties prop = System.getProperties();
|
||||||
|
Enumeration names = prop.propertyNames();
|
||||||
|
while (names.hasMoreElements()) {
|
||||||
|
String key = (String) names.nextElement();
|
||||||
|
String value = prop.getProperty(key);
|
||||||
|
System.out.println(key + "=" + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user