public class ThrowException
{
public static void main(String args[])
{
try
{
int a=6,b=0;
if(b==0)
throw new ArithmeticException("算术异常!");
}
catch(ArithmeticException x)
{
System.out.println("抛出的异常为:"+x);
}
}
}
程序中抛出异常
最新推荐文章于 2024-08-03 14:10:17 发布