(这是一个关于为什么这个异常没有被打印?为什么它显示错误的跟进问题)
在下面的代码中,为什么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
发生了什么?