File deletion

  • Eclipse: Oxygen
  • Java: 1.8

The concept of file deletion is shown here. This is done by a simple command of file.delete() method.

The Java File delete() method can be used to delete files, it will return a boolean value. It returns true if the file is deleted; false if failed.

In the following program, we are using the File.delete () method. It will delete txt file named “studyeasy\\team.txt”.

Output

Deletion is successful

Contributed by: Poonam Tomar


Full stack Java Developer

   Buy me a coffee!

 

PayTM QR (INDIA)

Download file

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu