Difference between e.printStackTrace and System.out.println(e)

前端 未结 6 1598
清歌不尽
清歌不尽 2021-01-31 17:05

Probably a newbie question, but everyone seems to use e.printStackTrace(), but I have always used System.out.println(e) when exception handling. What i

6条回答
  •  无人共我
    2021-01-31 17:23

    System.out.println(e) will not give you your stack trace, just the error message and exception type, as well as being printed to the standard output as opposed to error output.

提交回复
热议问题