Delete a File in Java

Yes, you can simply delete a file directly from your computer.
But you also have the power to delete a file from within a Java program.

The File class has a delete() method.

Consider the following program:


Return to Unit Menu | | | Terms of Use  |

Notice: These materials are free for your on-line use at this site, but are not free for the taking.
Please do not copy these materials or re-post them to the Internet, as it is copyright infringement.
If you wish hard-copies of these materials, refer to our subscription area,
Help us keep these resources free. Thank you.