what is unreachable code problem in multiple catch statements

Answers were Sorted based on User's Feedback



what is unreachable code problem in multiple catch statements..

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

what is unreachable code problem in multiple catch statements..

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

what is unreachable code problem in multiple catch statements..

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

Post New Answer

More Core Java Interview Questions

Can you extend more than one interface?

9 Answers  


What is difference between static method and static variable?

7 Answers  


What are advantages and disadvantages of OOPs?

0 Answers   Amdocs,


why String class is immutable.

5 Answers   iGate,


Where is the find and replace?

0 Answers  






Is java a super set of javascript?

0 Answers  


what are the different non-access specifiers in java?

5 Answers  


I/O blocking means?

1 Answers  


What is a class object?

0 Answers  


What is instance synchronization?

0 Answers  


Why java is secure? Explain.

0 Answers  


Give us the name of the list layoutmanagers in java?

0 Answers  


Categories