Tuesday, 18 March 2014

Java Program for Create New File

//wap that will create empty text file


//import java.iostream.*;
import java.io.*;
import java.io.File;
public class NewFile
{
    public static void main(String args[])
    {
        File file=new File("c:\\anant.txt");
        boolean Created=false;
       
        try
        {
            Created=file.createNewFile();
        }
        catch(IOException e)
        {
            System.out.println("error"+e);
            System.out.println("file is created"+file.getPath()+Created);
        }
    }
}



No comments: