You *could*, but that's not good programming practice (That is, you simply have all your functions declared as throwing generic Exceptions. The Java Exception model is designed that as your classes become more specialized, the types of exceptions they throw should also become more specialized. The only place were you should catch the base class of all exceptions, Exception, is in the main() body of the code or in the JApplet/JApplication object.
Note that you cannot throw a more generic exception type than your function/method allows. If FileException ISA IOException ISA Exception, then a function that defined itself to throw an IOException will be happy as long as only FileExceptions or IOExceptions are thrown, but will complain (AT COMPILE TIME, since the exception mechanism is that detailed) if you throw a generic Exception.
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
| [reply] |