1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
|
package com.mkyong.display;
import java.util.Properties;
public class DisplayApp {
public static void main(String[] args) {
Properties properties = System.getProperties();
// Java 8
properties.forEach((k, v) -> System.out.println(k + ":" + v));
// Classic way to loop a map
//for (Map.Entry<Object, Object> entry : properties.entrySet()) {
// System.out.println(entry.getKey() + " : " + entry.getValue());
//}
// No good, output is truncated, long lines end with ...
//properties.list(System.out);
}
} |