Java Exceptions
This collection of articles teaches you all about exceptions in Java.
-
Java Exceptions: Throw, Try and Catch
This article explains what exceptions are, including related concepts such as throwing, propagating and catching.
-
Java Exception Types
This article explains the difference between the various exception types offered by the Java API.
-
Chained Exceptions
Chained exceptions, or wrapped exceptions, are used to indicate that a lower level exception was the cause for a higher level exception.
-
Custom Exception
This page explains and provides examples for how to implement user defined custom exceptions.
-
Difference between Checked and Unchecked Exceptions
This article explains what the difference between checked and unchecked exceptions are.
-
Choosing between Checked and Unchecked Exceptions
When is it appropriate for a method throw an exception? Should it be checked or unchecked? This article answers these questions in depth, provides examples and a quick flowchart for future reference.
-
Checked Exceptions: Good or Bad?
Are checked exceptions a good language feature? Or is it a failed experiment where Java is the first and last language to support it? This article describes the pros and cons and explains why it's often misused and when it's a perfect fit.
-
Return Values vs Exceptions
When should a method throw an exception, and when should it use a return value to indicate an error? This article answers the question in detail and provides concrete examples.
-
try + finally
A finally block follows a try block and is always executed, regardless if the try block finishes normally or exceptionally.
-
try-with-resources
The try-with-resources feature is used to automatically close a file or other resource, no matter the outcome of a previous operation. It's a convenient way of guaranteeing that a state will be restored such as a resource being released.
-
Stack Traces
A stack trace describes the state of a thread. It says which methods have been called (but not yet returned) and is often used to debug problems.
-
Suppressed Exceptions
Suppressed exceptions are primarily used to deal with exceptions that are suppressed in a try-with-resource construct.
-
throw vs throws vs Throwable
This article explains the difference between three similar Java terms: throw, throws and Throwable
-
List of Java Exceptions
This page provides a complete list of all public exceptions and errors available in the Java API, grouped by package.