Exceptions: CS 310 Lecture notes

Object-Oriented Programming with Java Lecture Notes

3 March 2009 • Exceptions


The catch body could throw an exception. Because the exception occurred outside the scope of the associated try-catch statement, it acts like any other exception thrown outside a try block. However, one try-catch statement could be nested in the try block of another try-catch statement,

try {
  try {
    // blah blah blah
    }
  catch (...) { ... }
  catch (...) { ... }
  }
  catch (...) { ... }
  catch (...) { ... }

in which case the inner catch exception would be caught and dealt with by the outer try-catch statement (and so on and on, ad infinitum).


This page last modified on 24 January 2006.