Can multiple catch statements be used in exceptions ?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Explain the difference between an Interface and an Abstract class?
what is the use of declaring constructor as private?
5 Answers Cyient, IVY Technologies, Sai Softech, Virtusa,
What is the use of arraylist class in java?
what invokes a threads run() method? : Java thread
Difference between Map & Hashmap
How do you reverse a word in java?
Differences between C and Java?
What is the difference between Java Program Constructor and Java Program Method, What is the purpose of Java Program constructor Please Explain it Breafily?
What is a short in java?
Can we assign null to double in java?
What is the use of object and class classes?
Is null a keyword in java?