Yes. IOException is the super class of FileNotFoundException. So, if you put the catch statement for IOException above that for FileNotFoundException, then the code for second catch will become unreachable and the compiler will throw an error for that. Reason is simple: every object of a sub class can be easily accepted by a super class reference.
![]() |
No comments:
Post a Comment