delete file in java

Delete file in java

import java.io.File;

public class DeleteFile {
public static void main(String[] args) {
File f=null;
String path=”D:\a\hi.txt”;
try {
f=new File(path);
boolean b=f.delete();
System.out.println(“file delete=”+b);
} catch (Exception e) {
System.out.println(e);
}
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + 6 =