An exception is an abnormal condition that disrupts normal program flow. There are many cases where abnormal conditions happen during program execution, such as the following:
- The file you try to open may not exist.
- The class file you want to load may be missing or in the wrong format.
- The other end of your network connection may be disrupted for some mysterious reason.
- An operand is not in the legal range prescribed for operations or methods.
If these abnormal conditions are not prevented or at least handled properly, either the program will be aborted abruptly or the incorrect results or status will be carried on, causing more and more abnormal conditions. Imagine a program that reads from an unopened file and does computations based on those input values.
No comments:
Post a Comment