Tuesday, August 17, 2010

Keyword for throwing an exception

1. Which keyword is used to throw an exception?
"Throw"

2. Looking at the diagram below, discuss the options for exception handling. Should the exception be handled? If so, where should it be handled? Should it be rethrown? Why? Why not?



The exception should be handled on A and should be rethrown at B and C. This is because A is calling B and B is calling C. If C gets an exception, that should be rethrown for B and then B should rethrow it to A so it can be handled properly.

No comments:

Post a Comment