具体说明如下:
具体代码:
public class CopyOfFileUtls {
private static String path = "D:\\"; //成员变量
private static String filenameTemp; //成员变量
public static boolean createFile(String fileName,String filecontent){
Boolean bool = false; //局部变量
filenameTemp = path+fileName+".txt";
File file = new File(filenameTemp); ////局部变量
try {
if(!file.exists()){
file.createNewFile();
bool = true;
System.out.println("success create file,the file is "+filenameTemp);
//创建文件成首大功后枯芹宴,写入内容没银到文件里
writeFileContent(filenameTemp, filecontent);
}
} catch (Exception e) {
e.printStackTrace();
}
return bool;
}
public static void main(String[] args) {
CopyOfFileUtls uuid = new CopyOfFileUtls();
uuid.createFile("myfile", "随着越来越多的员工开始使用智能手机处理数据");
}
}