How To Delete A File In Java
Till now we have seen how to create a file, how to read data from a file, and how to write in a file.
Now we will study how to delete a file, and then how to delete a folder.
1. Delete a file - We can delete a file using delete() method which comes under File class.
Output - One sample outcome can be -
Another Possible outcome can be -