Testing Multiple catches:
x == 0
caught a char: B
End of try-catch system.
x == 1
caught an int: 1
End of try-catch system.
x == 2
caught a double: 1
End of try-catch system.
x == 3
Hello
End of try-catch system.
x == 4
End of try-block.
End of try-catch system.
END.
Testing Multiple catches:
x == 0
Exception caught!
End of try-catch block.
x == 1
Exception caught!
End of try-catch block.
x == 23
Exception caught!
End of try-catch block.
x == 3
Exception caught!
End of try-catch block.
x == 4
End of try-block.
End of try-catch block.
END.
Except that there is not a lot of point in placing the trythrow and catch in the same scope. The test function can throw, so enclose the function call (in main) in a try block. The catch would also have to be in main in that case, as it it is main which is handling the exception.