Online Tutorials & Training Materials |
Register Login

Difference between Error and Exception

|| || 0

Difference between Error and Exception

What is the difference between Error and Exception?


This table explains the various difference between Error and Exception:

  Error Exception
Definition An error is a serious issue which is mostly caused due to lack of system resources An exception is a moderate issue which is caused due to wrong coding.
Recovery It is impossible to recover from error, therefore the only option to solve error is to terminate execution. Whereas exception can be recovered from via using either try-catch blocks or throwing an exception back to the caller.
Categories Errors in Java belongs to single category i.e unchecked. Whereas there are two types of exceptions categories in Java which are exceptions checked and exceptions unchecked.
Package Errors in Java are defined as: java.lang.Error package Exceptions in Java are defined as java.lang.Exception
Handling Errors cannot be handled as runtime Exception can be handled at runtime.

Related Articles