File handling delete operation

Program for delete operation in file handling:

package com.journaldev.files;
import java.io.File;
public class FileHandling {
      public static void main(String[] args) {
               File file = new File("profjayesh.txt");
               boolean delete = file.delete();
               System.out.println("File deleted = " + delete);
      }
}
OUTPUT:

File deleted = true

Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.