FileWriter fwriter = new FileWriter("C:/Users/NULL NULL NULL/Desktop/New Text Document.txt", false); // set the write to false so we dont append to it
BufferedWriter write = new BufferedWriter(fwriter); // this is the type so we can write to it.
write.write(""); // write empty string to delet everything
write.close(); // close the buffer to gain back memory space that the buffer
が取り上げました。javaでファイルを削除せずにファイルの内容を空にするには?
このことについてどのように
まずは何が問題なのですか?次に指摘したコードをテストしましたか? –
私はこれがこれと重複していると信じています:[http://stackoverflow.com/questions/6994518/how-to-delete-the-content-of-text-file-without-deleting-itself](http://stackoverflow .com/questions/6994518 /テキストファイルの内容を削除する方法自体を削除する) –