using java to create a new directory and a file within it
i am trying to create a new directory and a file with in this
directory,can any one tell me where am i going wrong. i am using a windows
system and i want the directory to be present in the folder my .JAVA file
is present.
   import java.io.*;
   class  PS_Task1
    {
public static void main(String[] args)
{
    try
    {
    File file = new File("Library\\test.txt");
    file.mkdir();
    file.createNewFile();
    }
    catch(Exception e)
    {
        System.out.println("ecception");
    }
}
}
 
No comments:
Post a Comment