Lesson 13 - Exceptions in Java for the third time and more techniques
In the previous lesson on Java exceptions, Exceptions and Errors in Java for the Second Time, we looked in more
detail at the
catch block, creating exceptions,
and implementation of the exception and error system. Today we're going to look
more closely at how to chain exceptions and at more advanced techniques
associated with them.
As we've mentioned earlier, every throwable can have its cause (cause) since Java 1.4. As the official documentation says:
The cause is the throwable that caused this throwable to get thrown.
We can pass the cause to the throwable through the constructor. We have two choices:
...End of the preview...
ict.social is a large database made up of manuals and tutorials, whose main goal is to provide high-quality IT education to everyone. We started out in the Czech republic, where we display roughly a million articles per month and receive plenty of gratitude from our users. Thanks to our successful establishment, we are now bringing these articles to the rest of the world.
Although we are trying to keep our content free of charge, maintaining the site is a huge effort for everyone involved. Therefore, some content (exercises and more advanced material) costs network points. Don't worry, they're really cheap :)
Requested article covers this content:
We'll look at exception chaining, exception wrapping, the suppressed exceptions mechanism, and briefly at pluggable exception handlers.
Buying this article gives you unlimited access to it forever. You will learn some more and help us keep giving our site maintenance which helps you and others get better futures. It's a win-win.
You gain points by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.
You can get points immediately using:
|Credit card||SMS||Wire transfer|