Java PrintWriter create from BufferedWriter

Description

Java PrintWriter create from BufferedWriter


import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.PrintWriter;

public class Main {
  public static void main(String[] argv) throws Exception {
    FileWriter file = new FileWriter("a.html");
    BufferedWriter buffer = new BufferedWriter(file);
    PrintWriter out = new PrintWriter(buffer);
    out.println("line");
    out.println("demo from demo2s.com");
    out.close();/*w  w w .j  a  v a  2s  .co m*/
    buffer.close();
    file.close();
  }
}



PreviousNext

Related