>

Sunday, December 16, 2012

File Creation in java

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

public class FileCreatin {

    public static void main(String args[]) throws IOException
    {
        File f=new File("F:/java.txt");
        if(!f.exists())
        {
            f.createNewFile();
            System.out.println("file created successfully");
        }
        else
            System.out.println("File already exists");
       
    }
}

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.