system.out.println重定向

File file = new File("c:/a.txt");
PrintStream fi = null;
try {
fi = new PrintStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

System.setOut(fi);

你可能感兴趣的:(c,File)