How to use Java property files?

后端 未结 17 1392
时光取名叫无心
时光取名叫无心 2020-11-22 11:13

I have a list of key/value pairs of configuration values I want to store as Java property files, and later load and iterate through.

Questions:

  • Do I ne
17条回答
  •  萌比男神i
    2020-11-22 11:41

    Here is another way to iterate over the properties:

    Enumeration eProps = properties.propertyNames();
    while (eProps.hasMoreElements()) { 
        String key = (String) eProps.nextElement(); 
        String value = properties.getProperty(key); 
        System.out.println(key + " => " + value); 
    }
    

提交回复
热议问题