Basic HTML version of Foils prepared June 5 99

Foil 52 Exceptions

From Java Language in the Computer Science Curriculum ADMI Tutorial Duluth Minnesota -- June 3 99. by 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 Sat Jun 5 1999