於程式中拋出例外
throw 例外類別產生之物件
int a=100,b=0;
try
{
if(b==0)
throw new ArithmeticException();
else
System.out.println(a+"/"+b+"="+a/b);
}
catch(ArithmeticException e)
{
System.out.println(e+" 被拋出");
}Last updated
throw 例外類別產生之物件
int a=100,b=0;
try
{
if(b==0)
throw new ArithmeticException();
else
System.out.println(a+"/"+b+"="+a/b);
}
catch(ArithmeticException e)
{
System.out.println(e+" 被拋出");
}Last updated
java.lang.ArithmeticException 被拋出