目前只需掌握Properties属性类对象的相关方法即可Properties是一个Map集合,继承Hashtable,Properties的key和value都是String类型Properties被称为属性类对象.Properties是线程安全的。需要掌握Properties的存和取两个方法。
package collection;
import java.util.Properties;
public class PropertiesTest01 {
public static void main(String[] args) {
Properties pro = new Properties();
pro.setProperty("username","root");
pro.setProperty("password","123");
String username = pro.getProperty("username");
String password = pro.getProperty("password");
System.out.println(username);
System.out.println(password);
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-26620.html