Both Error and Exception are
derived from java.lang.Throwable in Java but main difference
between Error and Exception is kind of error they represent. java.lang.Error represent
errors which are generally can not be handled and usually refer catastrophic
failure e.g. running out of System resources, some examples of Error in Java
are java.lang.OutOfMemoryError
or Java.lang.NoClassDefFoundError
and java.lang.UnSupportedClassVersionError.
On the other hand java.lang.Exception represent errors which can
be catch and dealt e.g. IOException which comes while performing I/O
operations i.e. reading
files and directories. Clear understanding of Error and Exception is must
for any serious Java programmer and good programming and debugging skills are
required to overcome issues which caused Error and Exception in Java. Apart
from its must have knowledge in Java application development, difference
between Error and Exception is also a popular questions on Java interviews
related to Exception handling, similar to difference
between throw and throws in Java. In this Java article we will briefly see
major difference between Error and Exception in Java
which include both syntactical and logical difference.