| 9. | What will be the output of the program? try |
|||||||
Answer: Option C Explanation: Compilation fails because ArithmeticException has already been caught. ArithmeticException is a subclass of java.lang.Exception, by time the ArithmeticException has been specified it has already been caught by the Exception class. If ArithmeticException appears before Exception, then the file will compile. When catching exceptions the more specific exceptions must be listed before the more general (the subclasses must be caught before the superclasses). |
| 10. | What will be the output of the program? public class Foo |
|||||||
Answer: Option A Explanation: If you put a finally block after a try and its associated catch blocks, then once execution enters the try block, the code in that finally block will definitely be executed except in the following circumstances:
I suppose the last three could be classified as VM shutdown. |
