I know FileNotFound is Checked Exception but though it is, only during the Run time this exception will occur.It is more like Arithmetic Exception(Unchecked).
Whether it is checked or unchecked the exception will happen only during runtime.
My Question is why we call the FileNotFound/IO/DB
related stuffs as Checked Exception?
Please share me your valuable thoughts :)
Exceptions always encountered at runtime only, Difference is made when a exception is handled.
Checked or unchecked means whether it is forced to handle at compile time or it will only be identified when it is encountered at runtime.
If an exception is checked means compiler has way to identify whether the exception can occur or not. and whenever you compile it, you will be forced to handle a checked exception and by doing this chances of runtime exceptions will be reduced.
During file handling, compiler doesn't check whether file is present or not, it just check whether you have handled fileNotFoundException or not, because once you are dealing with a file chances of encountering this exception is very high and you should handle it in your code. for arithmetic Exception there is not way to find it during compile time. and thus it is left unchecked.