View Source

h3.Error Handling Code Samples



The Java programming language provides a flexible error handling model.

* [ListOfNumbers.java|http://java.sun.com/docs/books/tutorial/essential/exceptions/examples/ListOfNumbers.java] shows how to use a try and catch block to catch exceptions. For supporting information see [The Java Tutorial: Handling Errors Using Exceptions|http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html].

* ListOfNumbersWOHandler.java demonstrates how the compiler handles runtime and checked exceptions differently. A program must handle checked exceptions, but does not have to handle runtime exceptions. For supporting information see [The Java Tutorial: Handling Errors Using Exceptions|http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html].

----

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact