Assume you have class AutoFactory with two static methods called shutdown and reset. Neither method has any parameters. The shutdown; method may throw a ProductionInProgressException.

LANGUAGE: JAVA

CHALLENGE:

Assume you have class AutoFactory with two static methods called shutdown and reset. Neither method has any parameters. The shutdown; method may throw a ProductionInProgressException.

Write some code that invokes the shutdown method. If a ProductionInProgressException is thrown, your code should then invoke the reset method.

SOLUTION:

try {
    AutoFactory.shutdown();
} 
catch (ProductionInProgressException pipe) {
    AutoFactory.reset();
}