File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes unchecked exceptions handled programmatically 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 "unchecked exceptions handled programmatically" Watch "unchecked exceptions handled programmatically" New topic
Author

unchecked exceptions handled programmatically

Bob CHOI
Ranch Hand

Joined: Nov 10, 2006
Posts: 127
According to JAVA API

public class NumberFormatException extends IllegalArgumentException
public class IllegalArgumentException extends RuntimeException


they're unchecked exceptions, is it proper to handle them programmatically? :roll:


Hard work rewards
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It's entirely possible to handle unchecked exceptions programmatically. Whether it's proper may depend on your point of view. It seems that many Java programmers have been raised with a superstiious fear of unchecked exceptions which paralyzes them, preventing intelligent decision making. Don't let this happen to you. Consider exceptions on a case=by-case basis. If you know why an exception was thrown, and you can recover from the exception, then do so. Don't let some inane idea that "unchecked exceptions should not be caught" stop you. Such hopelessly general rules are usually wrong. Think for yourself.


"I'm not back." - Bill Harding, Twister
Bob CHOI
Ranch Hand

Joined: Nov 10, 2006
Posts: 127
Jim, Thanks for your convincing clarification!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unchecked exceptions handled programmatically