Can multiple catch statements be used in exceptions ?,Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher
Can multiple catch statements be used in exceptions ?

Yes! Multiple catch statement can be used in exceptions, but with some general rules.

 A single try block can have multiple catch associated with it but the each catch has an arguments according to the inheritance heirarchy of Exception. 

That means a subtype of Exception heirarchy must not be come in the catch block before the supertype of the Exception heirarchy. 

 Example:

 try{int i=3/0; //divide by zero exception}catch(Exception e){}catch(ArithematicException e){}

 The above code will result a compilation error \'unreachable code\' at the second catch statement because ArithematicException is a subtype of the Exception class. 

The above code should be like this:try{int i=3/0; //divide by zero exception}catch(ArithematicException e){}catch(Exception e){}

More interview questions and answers
Does java support multi dimensional arrays ?
Is multiple inheritance used in Java ?
Is there any tool in java that can create reports ?
What is meant by Java ?
What is meant by a class ?
What is meant by a method ?
What are the OOPS concepts in Java ?
What is meant by encapsulation ? Explain with an example.
What is meant by inheritance ? Explain with an example.
What is mean by JVM ?
What is meant by identifiers ?
What are the different types of modifiers ?
What are the primitive data types in Java ?
What is mean by a wrapper class ?
What is Garbage collection ?
What is mean by final class, methods and variables ?
What is mean by interface ?
What is the difference between an array and a vector ?
What is singleton class ?
What is constructor ?
What is casting ?
What is the difference between final, finally and finalize ?
What is mean by packages in java?
Name 5 calsses you have used ?
Name 2 classes that can store arbitrary number of objects ?
What is the difference between java.applet.* and java.applet.Applet ?
What is a default package ?
What is anonymous class ?
What is the use of an interface ?
What is a serializable interface ?
How to prevent field from serialization ?
What is the difference between throw and throws ?
Can multiple catch statements be used in exceptions ?
Is it possible to write a try within a try statement ?
What is mean by a Thread ?
What is mean by multi-threading ?
What is the 2 way of creating a thread ? Which is the best way and why?
What is the method to find if a thread is active or not ?
What is the difference between sleep and suspend ?
Can thread become a member of another thread ?
What are the three types of priority ?
Garbage collector thread belongs to which priority ?
What is the use of this ?
How can you find the length and capacity of a string buffer ?
How to compare two strings ?
What is the purpose of run-time class and system class?
What is the method used to clear the buffer ?
What is mean by Stream Tokenizer ?
What is serialization and de-serialisation ?
What is mean by Applet ?
How to find the host from which the Applet has originated ?
What is the life cycle of an Applet ?
How do you load an HTML page from an Applet ?
What is mean by getCodeBase and getDocumentBase method ?
What is the use of parameter tag ?
What is the difference between getAppletInfo and getParameterInfo ?
How to communicate between applet and an applet ?
What is mean by event handling ?
What are all the listeners in java and explain ?
What is mean by an adapter class ?
What are the types of mouse event listeners ?
What are the types of methods in mouse listeners ?
What is the difference between panel and frame ?
What is the default layout of the panel and frame ?
What is the difference between list and choice ?
What are the different types of Layouts ?
What is mean by CardLayout ?
What is the difference between GridLayout and GridBagLayout?
Which class has no duplicate elements ?
What is mean by Swing ?
What is the difference between an applet and a Japplet?
What are all the components used in Swing ?
What is mean by tab pans ?
What is the use of JTree ?
What is the use of JTable ?
What is mean by JFC ?
What is JAR file ?
What is mean by manifest files ?
What is two properties in Beans ?
What is the use of beaninfo ?
What are the interfaces you used in Beans ?
What are the classes you used in Beans ?
What is the difference between C++ & Java ?
What is the difference between Process and Threads ?
How will you initialize an Applet ?
What is the order of method invocation in an Applet ?
When is update method called ?
What is JNI ?
What is the base class for all swing components ?
Is there any tag in HTML to upload and download files ?
What is the Layout for ToolBar ?
How will you add panel to a Frame ?
What is the corresponding Layout for Card in Swing ?
What is light weight component ?
What is difference in between Java Class and Bean ?
Diff between Application and Applet ?
What is the use of Interface ?
Why Java is not fully objective oriented ?
What it the root class for all Java classes ?
What is the exact difference in between Unicast and Multicast object ? Where we will use ?