Java program which creates file dynamically
Put Commons-io 2.3 version jar in lib folder and add to class path and then run
package com.demo;
import java.io.File;
import java.io.IOException;
public class CreateFIle{
public static void main(String[] args) throws IOException {
File f;
f=new File("c:\\example" + File.separator + "kop.txt");
System.out.println("file is "+f);
System.out.println("check "+f.exists());
System.out.println("create "+f.createNewFile());
System.out.println("The absolute path of the file is: "
+f.getAbsolutePath());
}
}
No comments:
Post a Comment