java中Properties有什麼用,舉例說明?
3.9 Properties的用法
馬克-to-win:Properties裡面存著也是鍵值對,而且它更方便java對配置檔案,字串的操作,
例:3.9.1
import java.util.*;
public class TestMark_to_win {
public static void main(String args[]) {
Properties sala = new Properties();
Set name;
String str;
sala.put("zs", "1111");
sala.put("ls", "2222");
sala.put("ww", "3333");
sala.put("zl", "4444");
// Show all name and sala in hashtable.
name = sala.keySet(); // get set-view of keys
Iterator itr = name.iterator();
while (itr.hasNext()) {
str = (String) itr.next();
System.out.println("The sala of " +
/* public String getProperty(String key)Searches for the property
* with the specified key in this property list.*/
str + " is " + sala.getProperty(str) + ".");
更多內容請見原文,原文轉載自: