PPT Slide
?The finally clause of a try statement
provides a mechanism for executing a
section of code whether or not an exception
?This example closes a file when its work is
done, even if an error occurs:
public boolean searchFor(String file, String word)
input = new Stream(file);*
if (input.next() == word) return* true;
if (input != null) input.close();
* This can fail. * Finally is executed before any return.