Java中的properties配置文件怎么写,代码

2025-05-22 16:47:08
推荐回答(1个)
回答1:

public static void main(String[] args) {
  Properties p = new Properties();
  p.setProperty("id", "user1");
  p.setProperty("password", "123456");
  try{
      PrintStream stm = new PrintStream(new File("e:\test.properties"));
      p.list(stm);
   } catch (IOException e) {
      e.printStackTrace();
  }
}