import java.io.*;
public class haha {
public static void main(String[] args) {
PrintStream ps = null;
try {
FileOutputStream fos =
new FileOutputStream("e:\\bak\\log.dat");//在指定路径下生成文件,为什么我把文件夹bak去掉能生成
log.dat前面加bak就实例不了,只有ECLIPSE下输出
ps = new PrintStream(fos);
} catch (IOException e) {
e.printStackTrace();
}
if(ps != null){
System.setOut(ps);
}
int ln = 0;
for(char c = 0; c <= 60000; c++){
System.out.print(c+ " ");
if(ln++ >=100){ System.out.println(); ln = 0;}
}
}
}
只不过你在程序中打印的数据太多了,把异常给掩盖了