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);
}
}
}
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);
}
}
}
No comments:
Post a Comment