new PrintWriter(BufferedWriter, boolean autoFlush) : PrintWriter « java.io « Java by API






new PrintWriter(BufferedWriter, boolean autoFlush)

   
/*
 * Output: 
 *  
 */

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

public class MainClass {

  public static void main(String args[]) {

    try {

      // Create a print writer
      FileWriter fw = new FileWriter(args[0]);
      BufferedWriter bw = new BufferedWriter(fw);
      PrintWriter pw = new PrintWriter(bw, false);

      // Experiment with some methods
      pw.println(true);
      pw.println('A');
      pw.println(500);
      pw.println(40000L);
      pw.println(45.67f);
      pw.println(45.67);
      pw.println("Hello");
      pw.println(new Integer("99"));

      // Close print writer
      pw.close();
    } catch (Exception e) {
      System.out.println("Exception: " + e);
    }
  }
}
           
         
    
    
  








Related examples in the same category

1.new PipedWriter()
2.new PrintWriter(Writer out)
3.PrintWriter: close()
4.PrintWriter: print(char c)
5.PrintWriter: print(int i)
6.PrintWriter: println(Object x)
7.PrintWriter: println(String x)
8.PrintWriter: println(char x)
9.PrintWriter: println(double x)
10.PrintWriter: println(float x)
11.PrintWriter: println(int x)
12.PrintWriter: println(long x)
13.PrintWriter: println()
14.Writer: write(char[] cbuf)