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


1 Exceptions are run-time errors that may arise
  • divide by zero
  • opening a file that doesn't exist
2 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 }
3 Exceptions are described by objects which are instances or subclasses of the class Exception. You may create your own.
4 You don't have to handle all run-time exceptions such as divide by zero and array index out of bounds.

in Table To:


© 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