zoukankan      html  css  js  c++  java
  • java中System.err.print和System.out.print区别

    System.err.print    是报错专用输输出,有颜色标记,所有err打印的都在顶行输出

    System.out.print   是标准输出,白底黑字

    1. package iobuffer;
    2. public class ErrOut {
    3. public static void main(String argvs) {
    4. System.err.println("有颜色的输出"); //是报错专用输输出,有颜色标记
    5. System.out.println("我没有颜色"); //是标准输出,白底黑字
    6. }
    7. }

    代码运行结果

    原因二:

    同System.out.print()没有本质区别,err是运行期异常和错误反馈的输出流的方向。
    最直接的区别是,在控制台输出err是红色,比较醒目。
    还有一个比较重要:
    (1)System.out.println 能重定向到别的输出流,这样的话你在屏幕上将看不到打印的东西了,如输出到一个txt的log日志中.
    (2)而System.err.println只能在屏幕上实现打印,即使你重定向了也一样。

    						<div>
    							
    						</div>
    				</div>
                                    </div>
  • 相关阅读:
    iOS中的HTTPS
    HTTPS抓包之Charles
    组件化开发的一些思考
    Xcode 调试技巧
    iOS崩溃日志分析
    iOS依赖库管理工具之Carthage
    13.类的关系总结
    12.组合(Composition)
    11.聚合(Aggregation)
    10.关联(Association)
  • 原文地址:https://www.cnblogs.com/jpfss/p/12022474.html
Copyright © 2011-2022 走看看