
Specifying Exceptions 769
Explanation: In the above program, two try blocks are defined. One is defined in the function
sub(), and the other is defined in the function main(). The sub() function has two integer ar-
guments. When the sub() function is invoked, two integer values are sent to this function. The if
statement in the try block of the sub() function checks whether the value of the first variable,
that is, j is zero or non-zero. If it is non-zero, subtraction is carried out; otherwise, the throw state-
ment throws an exception. The catch block inside the function sub() collects this exception and
again throws the exception using the throw ...