//文件不存在則創建
File file=new File("D:/hashdog/a.text");
if(!file.exists())
{
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
//文件夾不存在則創建
File file =new File("D:/xyz/hashdog");
//如果文件夾不存在則創建
if (!file.exists() && !file.isDirectory()){
file .mkdirs();
}