clear file contents java code example
Example: how to clear a text file in java
File file = new File("/path/to/file.txt");
PrintWriter writer = new PrintWriter(file);
writer.print("");
writer.close();
File file = new File("/path/to/file.txt");
PrintWriter writer = new PrintWriter(file);
writer.print("");
writer.close();