package IO.file.test; import java.util.Properties; import java.util.Set; public class PropertiesDemo { public static void main(String[] args) { Properties pro=new Properties(); pro.setProperty("zhangsan", "30"); pro.setProperty("lisi", "32"); pro.setProperty("maer", "34"); pro.setProperty("mazi", "45"); pro.setProperty("wangwu", "12"); //修改值 pro.setProperty("mazi", "22"); Set<String> names=pro.stringPropertyNames(); for(String name:names){ String value=pro.getProperty(name); System.out.println(name); } } }