【发布时间】:2016-04-09 13:47:14
【问题描述】:
这个周末我在搞一个小项目,其中一部分我想获取我的输出结果,这些结果通常会进入我的控制台并将它们输出到一个 HTML 文件。
File file = new File("C:/Users/Files/Desktop/TestTest/Test22.html");
FileOutputStream fos = new FileOutputStream(file);
PrintStream ps = new PrintStream(fos);
System.setOut(ps);
System.out.println("The Total of this output is" + totalAmt);
System.out.println("Average amount is " + average);
现在两行都打印得很好。但是它们打印在一条线上,几乎一起运行,而且看起来一点也不吸引人。在将值打印到 html 页面之前,我可以在 Eclipse 中做些什么来格式化它?
【问题讨论】: