difference between System.out.println() and System.err.println()

user354299 picture user354299 · Jul 2, 2010 · Viewed 127.3k times · Source

What is the difference between System.out.println() and System.err.println() in Java?

Answer

Carlos G. picture Carlos G. · Jul 2, 2010

In Java System.out.println() will print to the standard out of the system you are using. On the other hand, System.err.println() will print to the standard error.

If you are using a simple Java console application, both outputs will be the same (the command line or console) but you can reconfigure the streams so that for example, System.out still prints to the console but System.err writes to a file.

Also, IDEs like Eclipse show System.err in red text and System.out in black text by default.