企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 方法 * store():保存数据到文件. * load():从文件中加载数据. ## 实例 ~~~ public static void main(String[] args) throws IOException { // write(); read(); } //持久化数据到文件中 public static void write() throws IOException { //定义properties Properties ps = new Properties(); ps.setProperty("张三", "18"); ps.setProperty("李四", "20"); ps.setProperty("王五", "16"); //把ps的数据持久化到文件中 ps.store(new FileWriter("info.properties"), "comment"); //comment是描述 } public static void read() throws IOException { Properties ps = new Properties(); //从文件中读取数据 ps.load(new FileReader("info.properties")); System.out.println(ps); } ~~~