当前位置: 代码迷 >> 综合 >> [Java] IO-04 打印流 PrintStream 语言促进人的思维 扩展眼界 : log4j
  详细解决方案

[Java] IO-04 打印流 PrintStream 语言促进人的思维 扩展眼界 : log4j

热度:29   发布时间:2023-12-14 09:19:44.0
import java.io.*;// 语言促进人的思维
public class TestPrintStream1 {public static void main(String[] args) {PrintStream ps = null;try {FileOutputStream fos = new FileOutputStream("d:\\bak\\log.dat");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;}}}
}
import java.io.*;public class TestPrintStream2 {public static void main(String[] args) {String filename = args[0];if (filename != null) {list(filename, Sy
  相关解决方案