配置文件Demo

		Properties ps= new Properties();
		try {
			ps.load(new FileInputStream("set.properties")); // 把配置文件读取到内存中
			System.out.println(ps.getProperty("name")); // 获取配置文件属性值
			
			ps.setProperty("phone", "137"); // 设置配置文件
			ps.store(new FileOutputStream("set.properties"), "add phone number"); // 把修改提交到文件, 第二个参数是修改注释
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
原文地址:https://www.cnblogs.com/zhz-8919/p/10796142.html