Saturday, August 2, 2008

Program to Delete a file

Java Code to delete a file:


package com.milestone.snippets;

import java.io.File;
import java.io.IOException;

/**
* @author AARYA
*
*/
public class CodeSnippetTester
{
/**
* @param args
*/
public static void main(String[] args)
{
boolean flag = (new File("addressbook.txt")).delete();
if (!flag)
{
System.out.println("Unable to delete the file");
}
}
}

0 comments: