Can multiple catch statements be used in exceptions ?

Answers were Sorted based on User's Feedback



Can multiple catch statements be used in exceptions ?..

Answer / syamkumarm

yes we can use multiple catch statements in exceptions
for example we r writing the program for databas connection
with some mathametical operations with some network concepts

then we may get arithmatic exception, sql exception, and
netwok exception socket, rmi etc there we need to catch all
thoes using different catch statement

Is This Answer Correct ?    7 Yes 0 No

Can multiple catch statements be used in exceptions ?..

Answer / ravikiran(aptech mumbai)

yes multiple exceptions are possible,But the super class of
the particular exeption has to follw the sub claa.Reverse
will not be posible

Is This Answer Correct ?    4 Yes 0 No

Can multiple catch statements be used in exceptions ?..

Answer / devarathnam

YES. u can use multipel catch statements.

Is This Answer Correct ?    3 Yes 0 No

Can multiple catch statements be used in exceptions ?..

Answer / pratik

Yah you can use multiple catch statement.But the super
class type object should not come in catch statment before
sub class type object.

Is This Answer Correct ?    3 Yes 0 No

Can multiple catch statements be used in exceptions ?..

Answer / sakthi k

Yes we can use multiple catch statement for the exception.
try
{
Sop("exception");
}
catch(NumberFormatException)
{
}
catch(Exception)
{
}
we have to include the child exception above the parent
exception otherwise it shows an error. .

Is This Answer Correct ?    0 Yes 0 No

Can multiple catch statements be used in exceptions ?..

Answer / sitaram

yes, multiple exceptions are possible.
we can write the program like this.

try{
}
catch(ArrayOutofBoundException e){ // Child Class.
}
----
catch(Exception e){ //parent class
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is flush () in java?

0 Answers  


How define set in java?

0 Answers  


What is the purpose of format function?

0 Answers  


What is the applet security manager, and what does it provide?

0 Answers  


What data type is string java?

0 Answers  






How will you reverse a singly-link list?

0 Answers   Akamai Technologies,


What is singletonlist in java?

0 Answers  


JSP is by default thread safe or not? what is the meaning of isThreadSafe="true" and isThreadSafe="false". Explain it? Thanks, Seenu

9 Answers   Huawei,


What is class level lock ?

0 Answers  


what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent

0 Answers  


How can we create a object of a class without using new operator.

1 Answers   Infosys, Nokia,


Can we declare an anonymous class as both extending a class and implementing an interface?

8 Answers   College School Exams Tests, JVA, TCS, Wipro,


Categories