Exception Handling using try catch
Exception Handling using try catch
PROGRAM:
class tryCatchExceptionHandling
{
public static void main(String args[])
{
try
{
int a=4/0;
System.out.println("This is try Block");
}
catch(ArithmeticException e)
{
System.out.println("ArithmeticException => "+e.getMessage());
}
}
}
/*
OUTPUT
ArithmeticException => / by zero
*/
Comments
Post a Comment