Exercise Solutions, Ch. 11
Chapter 11 Exercise Solutions
EX 11.1. Create a UML class diagram for the ProductCodes program.
EX 11.2. What would happen if the try statement were removed from the level1
method of the ExceptionScope class in the Propagation program?
If the try statement were removed from the level1 method, the
EX 11.3. What would happen if the try statement described in the previous exercise
were moved to the level2 method?
If the try statement were moved from the level1 method to the level2 method, the
EX 11.4. Look up the following exception classes in the online Java API
documentation and describe their purpose:
a. ArithmeticException
This exception is thrown when an exceptional arithmetic condition occurs, such as
b. NullPointerException
This exception is (most commonly) thrown when attempting to call an instance method
c. NumberFormatException
This exception is thrown when an application attempts to convert a string into a
d. PatterSyntaxException
This exception is thrown when a syntax error occurs in the pattern of a regular
EX 11.5. Draw the containment hierarchy for the LightBulb program.