Java удалить содержание файла
new FileWriter(FILE_PATH, false).close();
Panicky Puma
new FileWriter(FILE_PATH, false).close();
import java.io.File;
class Main {
public static void main(String[] args) {
// creates a file object
File file = new File("file.txt");
// deletes the file
boolean value = file.delete();
if(value) {
System.out.println("The File is deleted.");
}
else {
System.out.println("The File is not deleted.");
}
}
}