0

What is difference between system.out.println() and system.Error.println() ?

25th Aug 2017, 12:13 PM
Yatin Chaudhari
Yatin Chaudhari - avatar
2 Answers
+ 2
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.errin red text and System.out in black text by default. eg: public class PrintQueue { public static void main(String[] args) { for(int i = 0; i < 100; i++) { System.out.println("out"); System.err.println("err"); } } }
25th Aug 2017, 12:25 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
System.out is "standard output" (stdout) and System.err is "error output" (stderr). 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. http://net-informations.com/java/cjava/out.htm
24th May 2021, 4:40 AM
malcomvx