如果我試圖打印「a」的值,爲什麼它顯示錯誤?爲什麼異常會成爲錯誤?爲什麼這個異常不會被打印?爲什麼它顯示錯誤?
class Ankit1
{
public static void main(String args[])
{
float d,a;
try
{
d=0;
a=44/d;
System.out.print("Its not gonna printed"+a); //if Exception not occurs then it will print and it will ot goto catch block
}
catch(ArithmeticException e)
{
System.out.println("Print hoga"+a);//why error come??
}
}
}
你應該張貼的錯誤,這樣我們就可以幫助你更好。 – elyashiv
後續問題在這裏:http://stackoverflow.com/questions/12130800/why-the-exception-is-not-triggered-here –
後續是略有不同,稍有關係,我有點高興允許兩者。 – Kev