<B>-Kaleem Haqqi</B><BR>Java is mind work. Having the right frame of mind is essential.
a. the Error class is a RuntimeException
>> No the Error class is not a subclass of RuntimeException.
The super class of all exception classes i.e. java.lang.Throwable
has two immediate subclasses Exception and Error, so this
option is not correct.
b. No exceptions are subclass of Error
>> Yes, this option is correct.
c. Any statement that may throw an Error must be enclosed in a try block
>> It is not required.So this option is also not correct.
d. Any statement that may throw an Exception must be enclosed in a try block
>>No, we can declare it in the throws clause or put a try-catch block.
so this is not correct.
e. Any statement that may throw a RuntimeException must be enclosed in a try block
>> No, it is not required to put a try-catch block for RuntimeException as it is a unchecked exception. We need to put
a try-catch block or declare in the throws clause only if the exception is checked exception.So this one also is not correct
The correct answer is b.
Error does have sub-classes like LinkageError and ThreadDeath
SCJP2. Please Indent your code using UBB Code
SCJP2. Please Indent your code using UBB Code
Consider Paul's rocket mass heater. |