Search your topic here

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

LEAVE A REPLY