The point of catching checked exceptions is so your code can respond to a specific failure rather that a much less helpful "general error" type exception. An app might throw a SQLException if it was passed invalid SQL, or an IOException if it can't find a file etc.
(By the way, this would be better placed in the Java In General (beginner) forum)
Without getting into the checked vs unchecked discussion, let's just talk about checked. Something that I see often is:
There is no point at all in distinguishing the three catches if you just duplicate the response. So, catch different types only if you're really going to do something different. If they all do the same thing, just catch Exception.
Next, should you throw differnt types or just a common MyApplicationException? It's hard to guess if a future client will want to distinguish the various types of things that can go wrong in your method, but it's poor information hiding to reveal all the things that can go wrong. It's up to you.
Catching or throwing Exception of course invites that nasty unchecked discussion again. Search the various forums for more on that debate.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
You should not catch Exception. I won't say "ever" but in general avoid that like the plague. Wait for the compiler to complain about exceptions not being handled. Then add a catch if and only if you can actually do something about it. Otherwise declare that you throw it. In both cases, use the specific type complained about, not a general form.
Repeat that process for Runtime exceptions that you think you can correct, including the throws declaration if you can't. Declaring what you throw is good practice.
Now, if you want to log exceptions, that's cool, but rethrow the exception if it's not one you can handle. Maybe you want to chain it and throw a more specific type, that's OK too. You can do that whether it's checked or not. [ August 26, 2005: Message edited by: Rick O'Shay ]
For an SQLException we know that there is some Database related error, so we can give an appropriate error to the user. In case of FileNotFoundException we know that we are looking for some file which is not there and an appropriate message or action can be taken, all this as against the generic Exception