(这是对Why is this exception is not printing?为什么显示错误的后续问题? )
在下面的代码中,为什么没有触发 ArithmeticException?
class Exp
{
public static void main(String args[])
{
float d,a=1;
try
{
d=0;
a=44/d; //no exception triggered here.. why?
System.out.print("It's not gonna print: a="+a);
}
catch(ArithmeticException e)
{
System.out.println("Print exception: "+e);
}
}
}
相反,输出是:
It's not gonna print: a=Infinity
怎么了?