I know that this is not recommended , but what exactly the reason ? In which situation , it is recommended ? In K&B book it is given that , you will not get proper message ( log ) if you will use this , I am not getting why ? e.printStackTrace() will be called based on object ( Exception ) type ( late binding ) , so I think we will get proper message .
please help me . Thanks in advance .
posted 12 years ago
One reason may be this : In real project , we never just write printStackTrace() method in a catch block , we do something specific depends on exception type .
Like if there is FileNotFoundException then we can provide any local file . So we catch exception separately & do something specific for them .
In which situation , it is recommended ?
Well , I don't think , it is recommended in any situation .