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

后端 未结 7 609
情书的邮戳
情书的邮戳 2020-12-12 16:16

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

7条回答
  •  情歌与酒
    2020-12-12 16:52

    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.

提交回复
热议问题