Properties.propertyNames() has the following syntax.
public Enumeration <?> propertyNames()
In the following code shows how to use Properties.propertyNames() method.
//from w w w . j av a 2s . c o m import java.util.Enumeration; import java.util.Properties; public class Main { public static void main(String[] args) throws Exception { Properties prop = new Properties(); prop.put("Chapter Count", "200"); prop.put("Tutorial Count", "15"); prop.put("tutorial", "java2s.com"); // assign the property names in a enumaration Enumeration<?> enumeration = prop.propertyNames(); // print the enumaration elements System.out.println(enumeration.nextElement()); System.out.println(enumeration.nextElement()); } }
The code above generates the following result.