Java Properties .stringPropertyNames ()

Syntax

Properties.stringPropertyNames() has the following syntax.

public Set <String> stringPropertyNames()

Example

In the following code shows how to use Properties.stringPropertyNames() method.


// ww w . ja  v  a 2 s .  c  o m

import java.util.Properties;
import java.util.Set;

public class Main {

  public static void main(String[] args) {
    Properties prop = new Properties();

    prop.put("Chapter Count", "200");
    prop.put("Tutorial Count", "15");
    prop.put("tutorial", "java2s.com");
    
    // save the Property names in the set
    Set<String> set = prop.stringPropertyNames();

    System.out.println(set);
  }
}

The code above generates the following result.