简单点,源码
File f = new File("D:\\Documents\\Desktop\\222.txt");
if (f.exists()) {
System.out.print("文件存在");
} else {
System.out.print("文件不存在");
f.createNewFile();// 不存在则创建
}
BufferedWriter output = new BufferedWriter(new FileWriter(f,true));//true,则追加写入text文本
output.write("111awoeidaed");
output.write("\r\n");//换行
output.flush();
output.close();