提示

Java IO BufferedWriter 使用示例。@ermo

回到上一级

    public static void write() throws IOException {
        String filepath = "src/main/resources/output.txt";
        String data = "Some simple text.";
        BufferedWriter out = new BufferedWriter(new FileWriter(filepath));
        try {
            out.write(data);
        } finally {
            out.close();
        }

    }

    public static void main(String[] args) throws IOException {
        write();
    }