import java.io.*;
public class FileCreation {
public static void main(String args[]) throws IOException{
// throws IOException to handle Exception
File f=new File("F:/sam.txt"); //F is the drive and sam.txt is the name of file...
if(!f.exists()){
f.createNewFile();
System.out.println("File created successfully");
}
else
System.out.println("file creation error/file exists already");
}
}
public class FileCreation {
public static void main(String args[]) throws IOException{
// throws IOException to handle Exception
File f=new File("F:/sam.txt"); //F is the drive and sam.txt is the name of file...
if(!f.exists()){
f.createNewFile();
System.out.println("File created successfully");
}
else
System.out.println("file creation error/file exists already");
}
}
No comments:
Post a Comment
Please post your comments. Your comments make us to write more programs for you.