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 |
What are keywords in programming?
What is the Set interface?
What is a ternary operator in java? What is an interface?
Explain the concept of hashtables?
What is the need of transient variables in Java ?
Justify your answer that you can't define a method inside another method in java, if you can then how?
What is java dot?
how we can write the string concatenation program in java.
explain different ways of using thread? : Java thread
explain copyonwritearraylist and when do we use copyonwritearraylist?
List some important features of java 10 release?
How can we create a synchronized collection from given collection?