问题描述
这可能是一个新手问题,但希望您能帮助我. :)我有这样的东西:
This is probably a newbie question, but hope you can help me. :) I have something like this:
try
{
//try to do something there
}
catch (IOException e)
{
//handle the exception
e.printStackTrace();
}
我正在使用NetBeans IDE,由于某种原因,printStackTrace的下划线标有波浪线.当我按Alt + Enter时,提示应删除Throwable.printStackTrace().这是什么意思?谁能提供更多的见解,这可能意味着什么?还是我可以忽略这个?
I am using NetBeans IDE and for some reason the printStackTrace is underlined in a squiggly line. When I press Alt+Enter, it says Throwable.printStackTrace() should be removed. What does this mean? Could anyone give more insight as what this may mean? Or can I ignore this?
谢谢!
推荐答案
这只是一个建议.在eclipse中很好-我相信这只是IDE告诉您,还有其他一些更常规的方法可以做到这一点.我发现它对于调试很有用,并且应该在发生致命错误时告诉用户使用调试模式(例如控制台开关-d)来收集这些日志.
It is just a recommendation. In eclipse it is fine - I believe it is just the IDE telling you that there are more conventional methods of doing it, like some of the other answers.I find that it is useful for debugging, and that you should tell users when a fatal error is going to occur, to use a debug mode (like a console switch -d) to collect these logs.
这篇关于在Java中使用e.printStackTrace()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!