in K&B book at p.360:
it says "If there is no exception thrown in try block, execution transfers to // 4"
However, i just try:
--> compile error because IOException is never thrown in try {} even if try block may or may not throw an exception.
If I remove the first catch, the code compiles because Exception can catch any exception.
I just don't understand why the compiler fails. Why does it just let the second catch catches the exception? And I think the K&B book has a bug
it says "If there is no exception thrown in try block, execution transfers to // 4"
However, i just try:
--> compile error because IOException is never thrown in try {} even if try block may or may not throw an exception.
If I remove the first catch, the code compiles because Exception can catch any exception.
I just don't understand why the compiler fails. Why does it just let the second catch catches the exception? And I think the K&B book has a bug