This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "why should not caught Exception" Watch "why should not caught Exception" New topic
Author

why should not caught Exception

pooja jain
greenhorn
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 .


:d
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 .
 
 
subject: why should not caught Exception
 
Similar Threads
Insert for mysql
executeUpdate not updating and no exception thrown
read the contents of the Directory & then read a file from the directory
Writing bytes out to a socket
WSDP and AXIS