Deleting a file permanently in Java is dead simple that it is just a method away from it. The file.delete() method in the java.io.File lets you do this. Here is the example.
delete(): The delete method when called deletes the file permanently, if it exists. You can alternatively check its existence by using the exist() method in the java.io.File class.
------------------------------
Output
------------------------------
The file to be deleted is myfile.txt
delete(): The delete method when called deletes the file permanently, if it exists. You can alternatively check its existence by using the exist() method in the java.io.File class.
------------------------------
Output
------------------------------
The file to be deleted is myfile.txt
No comments:
Post a Comment