//文件不存在则创建
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();
}