PrintStream out;
try {
out = new PrintStream(new FileOutputStream( "C:\\RandomWalkResultater.txt", true));
System.setOut(out);
它不是在 C 中创建 txt 文件:顺便说一句,这在 mac 中可以正常工作,使用:
PrintStream out;
try {
out = new PrintStream(new FileOutputStream("/Volumes/DATA/Desktop/RandomWalkResultater.txt", true));
System.setOut(out);