示例
public
static
class
ClassA {
public
void
methodA {
try
{
//...
}
catch
( NullPointerException e ) {
//...
}
}
解决方案
为 throws 子句中声明的每个异常创建专门的 catch 子句。
public
static
class
ClassA {
public
void
methodA {
try
{
//...
}
catch
( Error e ) {
//...
}
}