JAVA中PrintWriter的用法

Posted JC97

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA中PrintWriter的用法相关的知识,希望对你有一定的参考价值。

    try (PrintWriter writer = new PrintWriter("student.txt")) {
            writer.println("姓名	语文	数学	英语	总分	");
            for (Student s : set) {
                writer.println(s.getName() + "	" + s.getChinese() + "	" +
                        s.getMath() + "	" + s.getEnglish() + "	" + s.getTotalScore());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

今天学到了一种简便的输出输出流方法,mark一下~

以上是关于JAVA中PrintWriter的用法的主要内容,如果未能解决你的问题,请参考以下文章