How to execute methods after an exception is thrown
How to execute the add() method in the program below
class ExceptionHandlingImpl
{
static void divide()
{
try
{
double a= 1/0;
}
catch(Exception e)
{
throw e;
}
}
static void add()
{
int a=20,b=30,c;
c=ab+b;
System.out.println(c);
}
public static void main(String args[])
{
divide();
add();
}
}
Why does the method add() doesn't execute when I give throw statement in
the divide() method. The add() method execute fine when throw is
commented.Is there anyway such that the exception is also thrown using
throw and the method succeeding it also gets executed.
No comments:
Post a Comment