public class ExceptionEx {
public void methodA()
{
try
{
System.out.println("Inside MethodA");
return;
}
finally
{
System.out.println("MethodA's finally");
}
}
public void methodB()
{
try
{
System.out.println("Inside MethodB");
throw new RuntimeException("Demo");
}
finally
{
System.out.println("MethodB's finally");
}
}
public static void main(String[] args) {
ExceptionEx exc=new ExceptionEx();
try
{
exc.methodB();
}catch(Exception e)
{
System.out.println("Exception"+ e);
}
exc.methodA();
}
}
0 comments:
Post a Comment