java将properties文件中用户no对应到User属性 load /* User user = new User(); user.setUserNo(从文件中读出来)*/ 将User的其他属性和对应的属性值写入到properties store
时间: 2024-06-05 22:07:28 浏览: 138
java加载属性配置文件(properties文件)——从入门到进阶
/* Properties prop = new Properties(); prop.setProperty("userNo", user.getUserNo()); prop.setProperty("userName", user.getUserName()); prop.setProperty("userAge", String.valueOf(user.getUserAge())); FileOutputStream fos = new FileOutputStream("user.properties"); prop.store(fos, "User Details"); fos.close(); */
阅读全文