Using File Class

import java.io.*;

publicclass MakeNewFile{

public MakeNewFile(String path){

File myFile =new File(path);

try{

myFile.createNewFile();

}

catch (Exception e){

System.out.println("ERROR !!");

}

System.out.println("Done");

}

}

Any one please help me on why this doesn't work? I am calling it by :

MakeNewFile myNewFile =new MakeNewFile (<path>);

thanks

[981 byte] By [me_no_knowa] at [2007-10-2 6:24:55]
# 1
worked for me
IanSchneidera at 2007-7-16 13:26:46 > top of Java-index,Java Essentials,New To Java...
# 2
huh ?
me_no_knowa at 2007-7-16 13:26:46 > top of Java-index,Java Essentials,New To Java...
# 3
I called it the same way you wanted to, and a file was made.Do you have a better definition of "doesn't work" ?
IanSchneidera at 2007-7-16 13:26:46 > top of Java-index,Java Essentials,New To Java...
# 4
Why don't you print more info on the Exception, instead of just "ERROR!"?e.printStackTrace();System.out.println(e.getMessage());
MLRona at 2007-7-16 13:26:46 > top of Java-index,Java Essentials,New To Java...
# 5
thanks, was being dumb. I thought that it would also create the directory as well.
me_no_knowa at 2007-7-16 13:26:46 > top of Java-index,Java Essentials,New To Java...