System.out.println()和System.err.println()之间的区别 [英] difference between System.out.println() and System.err.println()

查看:177
本文介绍了System.out.println()和System.err.println()之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

System.out.println() System.err.println()之间有什么区别Java?

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

推荐答案

在Java中 System.out.println()将从您正在使用的系统中打印到标准。另一方面, System.err.println()将打印到标准错误。

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.

如果你是使用简单的Java控制台应用程序,两个输出将是相同的(命令行或控制台),但您可以重新配置流,例如, System.out 仍然打印到控制台,但 System.err 写入文件。

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.

此外,像Eclipse这样的IDE显示 System.err 红色文本, System.out 默认为黑色文本。

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

这篇关于System.out.println()和System.err.println()之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆