How to Delete File in java

In this post we will see an example on how we can delete file in java. We will see examples of the File.delete() and File.deleteOnExit() methods in detail

Example : Delete File in java using File.delete()

File.delete() returns “true” if a file is deleted from the given path.
It returns “false” if no file is found or if it is unable to delete the file.

You can also delete file in java using File.deleteOnExit() method.
You can get more details about this method here