title: When/why to call System.out.flush() in Java
body: <p>Why do certain streams need to be flushed (<code>FileOutputStream</code> and streams from Sockets) while the standard output stream does not?</p>
  
  <p>Every time someone uses the <code>System.out</code> <code>PrintStream</code> object, be it while calling <code>println()</code> or <code>write()</code>, they never flush the stream.  However, other programmers habitually call <code>flush()</code> a <code>PrintStream</code>/<code>PrintWriter</code> with other streams.</p>
  
  <p>I've recently asked this question to several programmers and some believe that there is some background handling in Java to auto-flush the <code>System.out</code> stream but I can't find any documentation on that.</p>
  
  <p>Something like this makes me wonder if simply calling <code>System.out.println()</code> is platform independent as some systems may need you to flush the stream.</p>