PROGRAM-
class ExceptionDem1
{
public
static void main(String args[ ])
{
System.out.println("In the Main
block");
try
{
System.out.println("In the try
block");
int a=10,b=0,c;
c=a/b;
System.out.println("Result="+c);
}
catch(ArithmeticException ae)
{
System.out.println("Exception
:"+ae);
}
System.out.println("Outside the Try block");
}
}
Comments
Post a Comment