Nik Nik - 1 year ago 125
Java Question

System.out.println vs PrintWriter

Is there a difference in using these two? When would you use one over the other?



PrintWriter out = new PrintWriter(System.out);

Answer Source

The difference is that System.out is a PrintStream and the other one is a PrintWriter. Basically, PrintStream was meant to write a stream of bytes while PrintWriter was meant to write a stream of characters. For more information, see PrintStream vs PrintWriter

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download