異常分為檢查型異常和非檢查型異常(即繼承自runtimeException的異常,如空引用,數組越界等),在捕獲檢查型異常的時候有可能淹沒非檢查型異常。例如:
try
{
Class.method();//throws null pointer exception
....................
}
catch(Exception e)
{
e.printStackTrace();
}
在這里就會淹沒null pointer Exception,編程時一定要注意