Wednesday, 11 February 2015

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);
        }
    }   
}

No comments:

Post a Comment