Java Reference
In-Depth Information
vide(). The class DivisionException extends Exception and provides a
handler for a division by zero error.
The division by zero error is raised in the method Divide() but it is not
handled in that method. Note that Divide(), which does not contain a try
block, throws the DivisionException in the method's signature. Neither
does the PreDivide() method handle the exception. Here again, the ex-
ception is passed along the call chain by the throws clause in the
method's signature. The main() method, on the other hand, handles the
exception that was raised in the Divide() method. For this reason main()
contains a try block with the corresponding catch clause. The exception
handling chain, in this case, ends in main().
Search WWH ::




Custom Search