Answers for "how to delete a text file in java"

6

how to delete a file in java

File file = new File("filepath");
file.delete(); //Returns boolean
Posted by: Guest on November-21-2020
0

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();
Posted by: Guest on May-05-2021

Code answers related to "how to delete a text file in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language