TechnoBuzz

A Techno Blog, mainly about Java

Exception Fever

Exceptions Best Practices

Checked :  Java introduced availability of this kind of exception (java.lang.Exception). This type of excpetion represents useful information about the operation of a legally specified request that the caller may have had no control over and that the caller needs to be informed about [problems] [Challenges with Checked Exceptions ]With checked exceptions, Java language forces us to document all the anticipated ways in which control might exit a method:

  1. Java classes must declare any checked exceptions they throw in the method signature
  2. any method that calls a method that throws a checked exception of type E must either catch E or must also be declared to throw E

Unchecked : runtime exceptions (java.lang.RuntimeException). These are exceptions that occur as a result of programming errors or that the program could not be expected to catch (dereferencing a null pointer, falling off the end of an array, dividing by zero, and so on).

Recently, several well-regarded experts, including Bruce Eckel and Rod Johnson, have publicly stated checked exceptions have become a significant source of problems for many large projects.

December 18, 2004 - Posted by davidbloom | J2EE | | No Comments Yet

No comments yet.

Leave a comment