import java.io.*;
public class FileTest {
public static void main(String[] args) {
String s = new String();
String s1 = new String();
try {
File ff = new File("E:/temp");
if (ff.isDirectory()){
System.out.print("目录存在");
} else {
ff.mkdirs();
System.out.print("目录创建成功");
}
// true表示在文件末尾追加内容
FileWriter writer = new FileWriter(filepath, true);
s1 = "加入内容 \r\n";
output.write(s1);
output.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}