Q: When an error occurs, what can a program do?
A: Return to a safe state, save the user’s work and terminate
Q: What types of errors do you need to consider?
A: User Input errors, device errors and physical limitations, code errors
Q: What can you do when an error occurs?
A: + Return an error code + Terminate the program + Throw and exception
Q: What is an exception?
An exception is a type of error what can be broken up into two categories
Q: What is an unchecked exception?
Runtime Exceptions arise from faults of the programmer. They also go by the name of unchecked exceptions because the compiler does not check for these at compile time.
Another type of unchecked exception is an error.
Typically, you do not handle these in a try-catch block on principle of good practice. A good programmer could avoid these exceptions completely.
Examples of unchecked exceptions inlcude: + NullpointerExceptions + OutOfBounds + …
Q: What is a checked exception?
An unchecked exception could be thought of as a “fact of life” in the sense that a good programmer could not account for them perfectly.
This is because rather than arising from the programmer itself, these checked exceptions arise from faults of the environemnt such as