Write to text file without overwriting in Java

前端 未结 9 1375
失恋的感觉
失恋的感觉 2020-11-30 05:02

I am trying to write a method that makes a \"log.txt file\" if one does not already exist and then writes to the file. The problem that I am encountering is every time I cal

9条回答
  •  情书的邮戳
    2020-11-30 05:47

    BufferedWriter login = new BufferedWriter(new FileWriter("login.txt"));
    

    is an example if you want to create a file in one line.

提交回复
热议问题