【发布时间】:2012-12-13 14:53:27
【问题描述】:
try{
File file = new File("write.txt");
FileWriter writer = new FileWriter(file);
PrintWriter printWriter = new PrintWriter(writer);
printWriter.println("pqr");
printWriter.println("jkl");
printWriter.close();
PrintWriter printWriter = new PrintWriter(file);
printWriter.println("abc");
printWriter.println("xyz");
printWriter.close();
}
我不明白这两种方式有什么区别。 在哪种情况下我应该使用 printWriter 和 fileWriter。
【问题讨论】:
-
请在stackoverflow上查找已经回答的问题......stackoverflow.com/questions/5759925/…
-
这个问题与这里提出的不同。