Basic HTML version of Foils prepared July 6 99

Foil 36 Exceptions

From Use of Java Language in Computational Science DoD Modernization Users Group Conference Monterey -- June 7 99. by Nancy McCracken, Geoffrey C. Fox


Exceptions are run-time errors that may arise
  • divide by zero
  • opening a file that doesn't exist
They are handled with try and catch blocks: try { some code that may generate an exception } catch (Exception ex) { some code to handle this case }
Exceptions are described by objects which are instances or subclasses of the class Exception. You may create your own.
You don't have to handle all run-time exceptions such as divide by zero and array index out of bounds.



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Tue Jul 6 1999