What might go wrong inside the outer try{}
block
which would cause an exception?
(1) One of the files might not open. (2) There might be an error in reading from a file. (3) There might be an error in writing to a file. (4) One of the files might not close.
All of those problems are IOExceptions
so the outer try{}
could catch them all
with one catch{}
block.
But this one block would not be very specific about
which type of error it caught.
The constructors for FileInputStream
and FileOutputStream
throw a FileNotFoundException
when there is a problem.
Its catch{}
block
should precede the one for IOException
.
Fill in the blanks. (Copy and Paste from the first paragraph.)