FAQ

Java

JSP

Servlet


Advertisement



How differently does Java handle checked and unchecked exceptions?

  • If a method may throw checked exceptions, the calling code must handle the exception by either catching it or by declaring in the signature of the method (as throws). Unchecked exceptions do not have to be handled by the calling code.
  • If a method might throw a checked exception, it must be declared in the signature of the method. Unchecked exceptions do not have to be listed in the method signature.

When to use checked exceptions and unchecked exceptions? Please visit Best Practices for Exception Handling.


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend

Previous Next vertical dots separating previous/next from contents/index/pdf Contents

  |   |