Using e.printStackTrace() in Java

前端 未结 5 517
感情败类
感情败类 2021-02-01 12:31

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)
{
//handl         


        
5条回答
  •  时光说笑
    2021-02-01 12:48

    It's probably because printStackTrace() doesn't really handle the error as much as it just dumps the stack in the console. It acts as a placeholder until you replace it with proper error handling (if it is needed at all) and replace the output with a logger of some sort.

提交回复
热议问题