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

what is stringtolennizer with example?

2 Answers   Symphony,


Why string is a class?

1 Answers  


What is the difference between compare and compareto in java?

1 Answers  


What is difference between overloading and overriding?

2 Answers   Accenture,


Lowest Common ancestor in a Binary Search Tree and Binary Tree.

1 Answers   Amazon,


What is autoboxing and unboxing?

1 Answers  


whar are the draw backs of programming lang step by step in Clang and next in C++ and next and in Java nad in .Net

1 Answers  


what is the replacement for GOTO in java?

2 Answers   CTS,


What do you understand by garbage collection in Java? Can it be forced to run?

1 Answers   TCS,


What is the difference(or similarity if there are some) between object and a variable?

4 Answers   ME,


What are the two major components of JDBC?

5 Answers   CMC, Mind Tree,


Can I have constructor in Interface?

2 Answers  


Categories