62,614
社区成员
发帖
与我相关
我的任务
分享
System.setOut(new PrintStream("c:/test.txt"));
System.out.println("****************************************************");
package com.xjh.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
public class FileUpdate {
public static void main(String[] args) throws Exception {
StringBuilder sb = new StringBuilder("abc");
PrintWriter out = new PrintWriter(new File("c:\\b.txt"));
try {
out.print(sb);
} finally {
out.close();
}
}
}