Sail E0 Webinar
Question

Which statement is true?


Options:
A .  catch(X x) can catch subclasses of X where X is a subclass of Exception.
B .  The Error class is a RuntimeException.
C .  Any statement that can throw an Error must be enclosed in a try block.
D .  Any statement that can throw an Exception must be enclosed in a try block.
Answer: Option A

Option A is correct. If the class specified in the catch clause does have subclasses, any 

exception object that subclasses the specified class will be caught as well.

Option B is wrong. The error class is a subclass of Throwable and not Runtime Exception.

Option C is wrong. You do not catch this class of error.

Option D is wrong. An exception can be thrown to the next method higher up the call stack.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers