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 |
Difference between operator overloading and function overloading
0 Answers Tavant Technologies, Virtusa,
How many types of gc are there in java?
Why method overriding is used?
When finally clause is executed?
Explain the scope or life time of class variables or static variables?
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
What is meant by null and void?
Is integer immutable in java?
Which graphs are functions?
How do you remove spaces in java?
What is the use of optional ?
Why are the methods of the math class static?