标签: java file bufferedwriter
有没有办法删除/清除文件内容而不实例化BufferedWriter或删除文件?
答案 0 :(得分:1)
很容易就可以这样做:
File file = new File("Path/to/the/file"); file.delete(); // delete the file file.createNewFile(); // create a new and empty file