232k views
3 votes
Assume you have class AutoFactory with two static methods called shutdown and reset. Neither method has any parameters. The shutdown method may throw a ProductionProgressException. Write some code that invokes the shutdown method. If a ProductionProgressException is thrown, your code should then invoke the reset method.

a) java
Copy code
try
AutoFactory.shutdown();
catch (ProductionProgressException e)
AutoFactory.reset();


b) java
Copy code
AutoFactory.shutdown();

c) java
Copy code
AutoFactory.shutdown();
AutoFactory.reset();

d) java
Copy code
try
AutoFactory.reset();
catch (ProductionProgressException e)
AutoFactory.shutdown();

User Anjali A
by
8.0k points

1 Answer

0 votes

Final answer:

Option (a) is the correct code that invokes the shutdown method and handles a potential ProductionProgressException by invoking the reset method.

Step-by-step explanation:

Option (a) is the correct code that invokes the shutdown method and handles a potential ProductionProgressException by invoking the reset method. Here is the correct code:

try {
AutoFactory.shutdown();
} catch (ProductionProgressException e) {
AutoFactory.reset();
}

User Jon Duffy
by
7.3k points