Java Programming - Exceptions - Discussion
Discussion Forum : Exceptions - Pointing out the correct statements (Q.No. 5)
5.
Which statement is true?
Answer: Option
Explanation:
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.
Discussion:
6 comments Page 1 of 1.
Tamil said:
4 years ago
In a catch block;
For example catch (ArithmeticException e),
In the question catch(X x),
Match these two lines.
ArithmeticException=X.
e=x.
So, X(ArithmeticException) is the subclass of Exception.
Correct me, if I'm wrong.
For example catch (ArithmeticException e),
In the question catch(X x),
Match these two lines.
ArithmeticException=X.
e=x.
So, X(ArithmeticException) is the subclass of Exception.
Correct me, if I'm wrong.
Pratik Rajan Kale said:
6 years ago
Can anyone explain A option with good example?
Sumalya said:
8 years ago
May anybody explain the option A? please.
Divyang said:
9 years ago
For example, if the method is called in the Main(), no need for try catch inside the specified method.
That's the explanation for option D.
That's the explanation for option D.
Priyanshu said:
9 years ago
Can anyone please help me for explaining the option D?
I would be very grateful for your help.
I would be very grateful for your help.
Tamás Kifor said:
1 decade ago
It is possible that X is not subclass of Exception but subclass of Throwable.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers