What are errors?
- [Instructor] Let's discuss more specific errors. In the intro of this course, we learned that errors are a subset of throwables. They are an objects that can be thrown by an app indicating a serious problem. Errors are not meant to be caught or handled as they indicate conditions that should never occur. They are unchecked throwables meaning code will compile successfully. Even if a method or class could potentially throw an error. Though, there are a number of errors. I want to highlight two common errors, the IOError and the virtual machine error. IOError is thrown when there is an unrecoverable error with IO or input/output. It is thrown when it is best to terminate the program rather than attempt to handle the exception. Another common error is the virtual machine error to indicate an issue with the Java virtual machine or JVM. Running out of resources it needs to continue working. The subclasses of this error are internal error, unknown error, out of memory error and stack overfill error. Internal error, unknown error, and out of memory error are named appropriately. They're thrown whenever there's an internal issue, an unknown issue, or we have run out of memory. The stack overflow error has a name that is not as straightforward as the other three. Stack overflow occurs when an app is using too much of its memory stack causing the stack to overflow. The most common way for stack overflow errors to occur is through recursion. When an app recurses improperly or recurses too much, it runs out of stack. Now that we have covered errors to more detail and more specifically the stack overflow error, let's take a look at an example of this error.