Java IO Tutorial - Java PrintStream(OutputStream out, boolean autoFlush) Constructor








Syntax

PrintStream(OutputStream out, boolean autoFlush) constructor from PrintStream has the following syntax.

public PrintStream(OutputStream out,   boolean autoFlush)

Example

In the following code shows how to use PrintStream.PrintStream(OutputStream out, boolean autoFlush) constructor.

/*from w  w  w. jav  a2  s .  c o m*/

import java.io.*;

public class Main {

   public static void main(String[] args) {
      byte c = 70;

      
      PrintStream ps = new PrintStream(System.out,true);

      // write byte c which is character F in ASCII
      ps.write(c);

      // flush the stream
      ps.flush();

   }
}

The code above generates the following result.