I have two snippet of code :
class PreciseRethrow { public static void main(String[] str) { try { foo(); } catch (NumberFormatException ife)
In the first code snippet, you are re-throwing the NumberFormatException that could possibly come up. In the second code snippet, you are throwing just general Exception, which is not NumberFormatException, as the method has declared.
NumberFormatException
Exception