Hi, Thiru
The constructor of File class doesn't create a file - it just creates an instance... If you want to create a new file, you must call createNewFile() method:
File f = new File("test.txt");
f.createNewFile();
Quote from JDK API, File class
public File(String pathname)Creates a new File instance by converting the given pathname string into an abstract pathname. If the given string is the empty string, then the result is the empty abstract pathname.
public boolean createNewFile() throws IOExceptionAtomically
Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file. This method, in combination with the deleteOnExit() method, can therefore serve as the basis for a simple but reliable cooperative file-locking protocol.
Returns:
true if the named file does not exist and was successfully created; false if the named file already exists
Regards,
Jamal Hasanov
www.j-think.com