Difference between Error and Exception in java

Posted By on September 16, 2014


Download PDF
Java Exception Handling
Short Circuited Operators in JAVA

Difference between exception and error in Java

  • Exceptions are related to the application and an Error is related to the environment in which the application is running.
  • An Error can’t be recovered as it is fatal in nature, that is different in the case of an Exception that may not be fatal in all cases.
  • An Exception is basically divided into two categories, i.e. Checked and Unchecked Exceptions. A Checked Exception has a special place in the Java programming language and requires a mandatory try catch finally code block to handle it. On the other hand an Unchecked Exception is a subclass of Runtime Exception that usually represents programming errors.
  • Exceptions can be checked or unchecked to indicate an error caused by the programmer should be handled at the application level. Whereas errors are always unchecked and usually indicate a system error or a problem with a low level resource should be handled at the system level, if possible.
  • Like Exceptions, Errors in Java are also unchecked. The compiler will not throw a compile time error if it doesn’t see an Error handled with a try catch or finally block. In fact handling an Error is not a good idea because recovery from an Error is usually not possible.
Java Exception Handling
Short Circuited Operators in JAVA

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com