当我写这篇
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-drive 中创建
但是当我使用这个
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");
它抛出异常。
请赐教