文件创建

//文件创建
public boolean creatFile(String fatherFile,String childFile){
 File dirObject = new File(fatherFile);
        File fileObject = new File(fatherFile,childFile);
        try{
            dirObject.mkdir();
        }catch(SecurityException e){
            e.printStackTrace();
        }
        try{
            fileObject.createNewFile();
        }catch(IOException e)
        {
            e.printStackTrace();
        }
        if(fileObject.exists())
         return true;
        return false;
 }
//*****************************************************************************
代码
//文件创建
public boolean creatFile(String fatherFile,String childFile){
File dirObject
= new File(fatherFile);
File fileObject
= new File(fatherFile,childFile);
try{
dirObject.mkdir();
}
catch(SecurityException e){
e.printStackTrace();
}
try{
fileObject.createNewFile();
}
catch(IOException e)
{
e.printStackTrace();
}
if(fileObject.exists())
return true;
return false;
}
//*****************************************************************************
原文地址:https://www.cnblogs.com/frostbelt/p/1766769.html