jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why should not caught Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "why should not caught Exception" Watch "why should not caught Exception" New topic

why should not caught Exception

pooja jain
Ranch Hand

Joined: Jan 12, 2005
Posts: 213

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 .

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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 .
I agree. Here's the link: http://aspose.com/file-tools
subject: why should not caught Exception
It's not a secret anymore!