16.05. File deletion

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

Contributed by: Poonam Tomar

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments