这段代码显示异常:
Exception in thread "main" java.lang.ArithmeticException: / by zero
at Ankit2.main(Ankit2.java:6)
为什么以及如何发生?不使用 try and catch 块?
class ankit1
{
public static void main(String args[])
{
float a=20,b=120,c=50,sum;
sum=(a+b+c)/0;
System.out.println("The average of three number is:"+sum);
}
}