how to clear a text file in java

Solutions on MaxInterview for how to clear a text file in java by the best coders in the world

showing results for - "how to clear a text file in java"
Briella
21 Oct 2016
1File file = new File("/path/to/file.txt");
2PrintWriter writer = new PrintWriter(file);
3writer.print("");
4writer.close();