Thus, in the following example, failure to find a file would activate the
block associated with the FileNotFoundException
class, rather than
the one associated with the IOException
class:
try { <-- An attempt to attach a stream to a file occurs here } // More specific exception caught: catch (FileNotFoundException e) { System.out.println("Evidently the input file does not exist."); } // More general exception caught: catch (IOException e) { System.out.println("Evidently an input--output error occurred."); }