集合之Properties
集合之Properties
以下代码使用Properties来存取键值对:
package com.javalearn.map.properties;
import java.util.Properties;
public class TestForPro {
public static void main(String[] args) {
Properties p = new Properties();
p.setProperty("name","cxf"); // 存,只能存String,String
p.setProperty("passwd","smf");
System.out.println(p.getProperty("name")); // 取
}
}
输出结果:
cxf