package com.ray.testexception;
public class TestException
{
public static void main(String[] args)
{
int x = 10;
int y = 0;
try
{
System.out.println(x / y);
}
catch (ArithmeticException e)
{
// TODO: handle exception
System.out.println("ArithmeticException");
}
catch (Exception e)
{
// TODO: handle exception
System.out.println("Exception");
}
finally
{
System.out.println("finally");
}
}
}
输出结果:
111111111
ArithmeticException
finally