Java Programming/Unchecked Exceptions

Unchecked, uncaught or runtime exceptions are exceptions that can be thrown without being caught or declared:

...however, you can still declare and catch such exceptions. Runtime exceptions are not business exceptions. They are usually related to hard-coded issues like data errors, arithmetic overflow, divide by zero etc. In other words, errors that can't be worked around nor anticipated. The most famous (and feared) runtime exception is the.

A runtime exception must be or inherit from the  class or the   class.

Sometime it is desirable to catch all exceptions for logging purposes, then throw them back in. For example, in servlet programming when an application server calls the server, we want to monitor that no exceptions happened during the serving of the request. The application has its own logging separate from the server logging so the runtime exceptions would just go through without being detected by the application. The following code checks all exceptions, logs them and throws them back again.

In the above code, all business logic exception are handled in the  method. Runtime exceptions are caught for logging purposes, and then thrown back to the server to be handled.