what is unreachable code problem in multiple catch statements
Answers were Sorted based on User's Feedback
Answer / deepthi
if v just gve a default exception block,bfre the specific
catch statement it ll create a unreachable code exception
e.g
catch(Exception e)
{System.out.println(unknown exception);}
catch(ArithmeticException e)
{System.out.println("Division by zero");}
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / sriragv
Subclass exception handler should come first then the
superclass has to come next. Then only code wil compile
otherwise subclass exception will be never reached results
compilation error.
| Is This Answer Correct ? | 5 Yes | 0 No |
Answer / bijoy baby
super class can handle sub class Exception. That's why when
super class handler placed before sub class handler then the
exception object will not thrown to sub class handler.
| Is This Answer Correct ? | 1 Yes | 0 No |
What is final variable?
What is java util list?
What is high level language in computer?
what is difference between type 4 driver and type 1 driver?
2 Answers CMC, CTS, IBM, JK Technosoft, Napier Healthcare,
Can interface be private in java?
Is string a class?
What is lastindexof in java?
What do you mean by formatting?
How does multithreading take place on a computer with a single cpu in java programming?
What is the purpose of interface?
how to convert mm/dd/yy to dd/mm/yy using collections in java.
what is difference between colection and collections?
25 Answers Amdocs, IBM, Infosys, Ipog Software, Polaris, Tech Mahindra,