私がこの作品を書くとき
String path="d:\\test.txt";
boolean chk;
File f=new File(path);
try
{
chk=f.createNewFile();
}catch(IOException e)
{
chk=false;
e.printStackTrace();
}
if(chk)
System.out.println("file created.");
else
System.out.println("file not created");
ファイルはdドライブで作成されます
でもこれを使うと
String path="d:\\test.txt";
File f=new File(path);
if(f.createNewFile())
System.out.println("file created.");
else
System.out.println("file not created");
例外をスローします。
これについて教えてください