What is the difference between System.out.println()
and System.err.println()
in Java?
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.