【发布时间】:2013-09-22 16:38:06
【问题描述】:
我注意到有两种检查异常:
1)
public static void main (String []args)
{
try{
//no exception thrown here, it still compiles though.
}
catch(Exception e){System.out.println(e);}
}
2)
public static void main (String []args)
{
try{
// it does not compile if not written any code which potentially might throw it
}
catch(IOException io){System.out.println(io);}
}
是否有任何规则可以预测这种行为?提前知道哪些不是必须在场的吗? 希望我已经很清楚地解释了这个问题。 谢谢, 确实是
【问题讨论】: