The
| |||
Rather than
explicitly catching an exception you can declare that your method throws
the exception. This passes the repsonsibility to handle it to the method
that invokes your method. This is done with the
A single method may have the potential to throw more than
one type of exception. In this case the exception clases are just
separated by commas. For example,
You can declare that your method throws runtime exceptions though you do not have to. The main use of this is as documentation for the programmer. It can also be useful in white box testing. | |||
|