Exceptions
Exceptions are run-time errors that may arise
- divide by zero
- opening a file that doesn’t exist
They are handled with try and catch blocks: try { some code that may generate an exception } catch (Exception ex) { some code to handle this case }
Exceptions are described by objects which are instances or subclasses of the class Exception. You may create your own.
You don’t have to handle all run-time exceptions such as divide by zero and array index out of bounds.