Specifications
Sun Services
Java™ Programming Language
Module 9, slide 8 of 37
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
The Properties Class
1 import java.util.Properties;
2 import java.util.Enumeration;
3
4 public class TestProperties {
5 public static void main(String[] args) {
6 Properties props = System.getProperties();
7 Enumeration propNames = props.propertyNames();
8
9 while ( propNames.hasMoreElements() ) {
10 String propName = (String) propNames.nextElement();
11 String property = props.getProperty(propName);
12 System.out.println("property ’" + propName
13 + "’ is ’" + property + "’");
14 }
15 }
16 }










