An Error "indicates serious problems that a reasonable application should not try to catch."

while

An Exception "indicates conditions that a reasonable application might want to catch."

Error along with RuntimeException & their subclasses are unchecked exceptions. All other Exception classes are checked exceptions.

Checked exceptions are generally those from which a program can recover & it might be a good idea to recover from such exceptions programmatically. Examples include FileNotFoundException, ParseException, etc. A programmer is expected to check for these exceptions by using the try-catch block or throw it back to the caller

On the other hand we have unchecked exceptions. These are those exceptions that might not happen if everything is in order, but they do occur. Examples include ArrayIndexOutOfBoundException, ClassCastException, etc. Many applications will use try-catch or throws clause for RuntimeExceptions & their subclasses but from the language perspective it is not required to do so. Do note that recovery from a RuntimeException is generally possible but the guys who designed the class/exception deemed it unnecessary for the end programmer to check for such exceptions.

Errors are also unchecked exception & the programmer is not required to do anything with these. In fact it is a bad idea to use a try-catch clause for Errors. Most often, recovery from an Error is not possible & the program should be allowed to terminate. Examples include OutOfMemoryError, StackOverflowError, etc.

Do note that although Errors are unchecked exceptions, we shouldn't try to deal with them, but it is ok to deal with RuntimeExceptions(also unchecked exceptions) in code. Checked exceptions should be handled by the code.

Answer from Nirmal- thInk beYond on Stack Overflow
Top answer
1 of 4
307

An Error "indicates serious problems that a reasonable application should not try to catch."

while

An Exception "indicates conditions that a reasonable application might want to catch."

Error along with RuntimeException & their subclasses are unchecked exceptions. All other Exception classes are checked exceptions.

Checked exceptions are generally those from which a program can recover & it might be a good idea to recover from such exceptions programmatically. Examples include FileNotFoundException, ParseException, etc. A programmer is expected to check for these exceptions by using the try-catch block or throw it back to the caller

On the other hand we have unchecked exceptions. These are those exceptions that might not happen if everything is in order, but they do occur. Examples include ArrayIndexOutOfBoundException, ClassCastException, etc. Many applications will use try-catch or throws clause for RuntimeExceptions & their subclasses but from the language perspective it is not required to do so. Do note that recovery from a RuntimeException is generally possible but the guys who designed the class/exception deemed it unnecessary for the end programmer to check for such exceptions.

Errors are also unchecked exception & the programmer is not required to do anything with these. In fact it is a bad idea to use a try-catch clause for Errors. Most often, recovery from an Error is not possible & the program should be allowed to terminate. Examples include OutOfMemoryError, StackOverflowError, etc.

Do note that although Errors are unchecked exceptions, we shouldn't try to deal with them, but it is ok to deal with RuntimeExceptions(also unchecked exceptions) in code. Checked exceptions should be handled by the code.

2 of 4
25

Error and Exception both extend Throwable, but mostly Error is thrown by JVM in a scenario which is fatal and there is no way for the application program to recover from that error. For instance OutOfMemoryError.

Though even application can raise an Error but its just not a good a practice, instead applications should use checked exceptions for recoverable conditions and runtime exceptions for programming errors.

🌐
GeeksforGeeks
geeksforgeeks.org › java › errors-v-s-exceptions-in-java
Errors V/s Exceptions In Java - GeeksforGeeks
July 11, 2025 - Instead, the best course of action is usually to log the error and exit the program. Exceptions, on the other hand, are used to handle errors that can be recovered from within the program.
People also ask

What is the difference between Errors and Exceptions in Java?
The primary difference is that errors are due to the scarcity of system resources and it's not possible to recover from an error, while exceptions can appear at runtime and compile time and it's possible to recover from an exception.
🌐
testbook.com
testbook.com › home › key differences › difference between error and exception in java with examples
Difference Between Error and Exception in Java with Examples
What are Errors in Java?
The error signifies a situation that mostly happens due to the absence of system resources. The system crash and memory errors are an example of errors. It majorly occurs at runtime.
🌐
testbook.com
testbook.com › home › key differences › difference between error and exception in java with examples
Difference Between Error and Exception in Java with Examples
What are Exceptions in Java?
The exceptions are the issues that can appear at runtime and compile time. It majorly arises in the code or program authored by the developers. There are two types of exceptions: Checked exceptions and Unchecked exceptions.
🌐
testbook.com
testbook.com › home › key differences › difference between error and exception in java with examples
Difference Between Error and Exception in Java with Examples
🌐
Testbook
testbook.com › home › key differences › difference between error and exception in java with examples
Difference Between Error and Exception in Java with Examples
Exceptions are caused by issues in the application code while Errors are caused due to environment or system issues like hardware failures etc. Difference Between Abstraction and Encapsulation in Java
🌐
Baeldung
baeldung.com › home › java › core java › errors and exceptions in java
Errors and Exceptions in Java | Baeldung
January 8, 2024 - Instances of Error and Exception are created to include information about the situation (for example, the stack trace): Errors indicate abnormal situations that should never happen. An error is thrown when a serious problem has occurred.
🌐
HowDev
how.dev › answers › what-is-the-difference-between-errors-and-exceptions-in-java
What is the difference between errors and exceptions in Java?
Errors and exceptions are subclasses of the Throwable Java class. The Error class represents critical conditions that can not be caught and handled by the code of the program. On the other hand, the Exception class represents concerning conditions ...
🌐
Shiksha
shiksha.com › home › it & software › it & software articles › programming articles › difference between errors and exceptions in java
Difference Between Errors and Exceptions in Java
April 18, 2025 - In Java, one of the main difference between errors and exceptions is that errors represent severe issues that indicate resource exhaustion or system problems beyond the program's control.
🌐
Scaler
scaler.com › topics › java › error-vs-exception-in-java
Difference Between Error and Exception in Java - Scaler Topics
April 13, 2022 - In Java, both Error and Exception are subclasses of Throwable, with Error often indicating severe system resource issues, while Exceptions can occur during runtime and disrupt normal program flow, often being manageable through specific code constructs.
Find elsewhere
🌐
BrowserStack
browserstack.com › home › guide › difference between an error and an exception
Difference between an Error and an Exception | BrowserStack
July 16, 2025 - They are part of Java’s robust exception-handling mechanism, which helps developers manage unexpected situations gracefully. Errors are system-level issues that are generally unrecoverable during program execution.
🌐
BYJUS
byjus.com › gate › difference-between-errors-and-exceptions-in-java
Difference between Errors and Exceptions in Java
September 28, 2022 - Both exceptions and errors are the subclasses of a throwable class. The error implies a problem that mostly arises due to the shortage of system resources. On the other hand, the exceptions occur during runtime and compile time. Let’s find out some major differences between exceptions and errors.
🌐
CS Fundamentals
cs-fundamentals.com › tech-interview › java › difference-between-error-and-exception-in-java
Difference Between Error and Exception in Java. Error vs Exception
However, both Errors and Exceptions ... class but an Error indicates serious problems that a reasonable application should not try to catch, while we can catch exceptions at runtime using try, catch and finally blocks....
🌐
Reddit
reddit.com › r/learnprogramming › general difference between exceptions and errors?
General difference between Exceptions and Errors? : r/learnprogramming
August 7, 2022 - There is no industry-wide generically defined difference. Exceptions are often used as one method of signalling an error, and as you mention they're extremely prevalent in Java, but Java is the exception here rather than the rule.
🌐
TutorialsPoint
tutorialspoint.com › difference-between-exception-and-error-in-java
Difference between Exception and Error in Java
In this article, we will compare the Java Error class and the Java Exception class. Both exceptions and errors are subclasses of the Throwable class. The error indicates a problem that mainly occurs due to the lack of system resources and our applica
🌐
Blogger
javahungry.blogspot.com › 2019 › 10 › difference-between-error-and-exception.html
6 Difference between Error and Exception in Java with Examples | Java Hungry
Java developers tutorials and coding. ... Difference between Error and Exception in java is one of the most common interview questions for java beginners. Errors are the conditions that can not be handled and irrecoverable. Every time when Error occurs, the program terminates abruptly.
🌐
Java Concept Of The Day
javaconceptoftheday.com › home › difference between error vs exception in java
Difference Between Error Vs Exception In Java
March 24, 2021 - 2) You will not be able to handle the Errors using try-catch blocks. Even if you handle them using try-catch blocks, your application will not recover if they happen. On the other hand, Exceptions can be handled using try-catch blocks and can make program flow normal if they happen. 3) Exceptions in java are divided into two categories – checked and unchecked.
🌐
Javatpoint
javatpoint.com › exception-vs-error-in-java
Exception Vs Error in Java - Javatpoint
Exception Vs Error in Java with java tutorial, features, history, variables, object, programs, operators, oops concept, array, string, map, math, methods, examples etc.
Top answer
1 of 11
199

Errors should not be caught or handled (except in the rarest of cases). Exceptions are the bread and butter of exception handling. The Javadoc explains it well:

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.

Look at a few of the subclasses of Error, taking some of their JavaDoc comments:

  • AnnotationFormatError - Thrown when the annotation parser attempts to read an annotation from a class file and determines that the annotation is malformed.
  • AssertionError - Thrown to indicate that an assertion has failed.
  • LinkageError - Subclasses of LinkageError indicate that a class has some dependency on another class; however, the latter class has incompatibly changed after the compilation of the former class.
  • VirtualMachineError - Thrown to indicate that the Java Virtual Machine is broken or has run out of resources necessary for it to continue operating.

There are really three important subcategories of Throwable:

  • Error - Something severe enough has gone wrong the most applications should crash rather than try to handle the problem,
  • Unchecked Exception (aka RuntimeException) - Very often a programming error such as a NullPointerException or an illegal argument. Applications can sometimes handle or recover from this Throwable category -- or at least catch it at the Thread's run() method, log the complaint, and continue running.
  • Checked Exception (aka Everything else) - Applications are expected to be able to catch and meaningfully do something with the rest, such as FileNotFoundException and TimeoutException...
2 of 11
53

This slide showing Java's exception hierarchy by @georgios-gousios concisely explains the differences between Errors and Exceptions in Java.

🌐
Tech Differences
techdifferences.com › home › difference between error and exception in java
Difference Between Error and Exception in Java (with Comparison Chart) - Tech Differences
December 25, 2019 - “Exception” is the exceptional ... between error and exception is that an error is caused due to lack of system resources, and an exception is caused because of your code....
🌐
C# Corner
c-sharpcorner.com › UploadFile › fd0172 › difference-between-an-error-and-exception
Difference Between An Error And Exception in Java
July 23, 2019 - Both errors and exceptions are derived from "java.lang.Throwable" in Java. Exceptions are related to the application and an Error is related to the environment in which the application is running.
🌐
freeCodeCamp
forum.freecodecamp.org › t › help-with-the-difference-between-error-and-exception › 353174
Help with the difference between error and exception - The freeCodeCamp Forum
February 25, 2020 - Im having a really hard time understanding the concept and the differences between errors and exception. i’m really looking for a definition and example of each. something to help me understand this. i dont know Java but…
🌐
Unstop
unstop.com › home › blog › top 10 differences between error & exception in java (+codes)
Top 10 Differences Between Error & Exception In Java (+Codes) // Unstop
January 16, 2025 - Errors in Java programming are serious problems that occur in the runtime environment and are typically not recoverable (e.g., OutOfMemoryError, StackOverflowError). Exceptions, on the other hand, are issues that arise during the program's execution ...