The in.close() closes the InputStream whereas the out.close() closes the OutputStream. Those statements are in the finally clause to ensure that those statements are executed. The checking for the null condition is necessary to avoid the NullPointerException if in or out is null.
SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
As I've already mentioned in my above post, you need to have the null checking in order to prevent your code from having the NullPointerException.
When the code gets into line 4, and suppose that it throws an exception, it will then go to line 11 because of the finally clause, but "in" instance is still null in this case. If you don't do any null checking here, you will get NullPointerException when you try to call in.close(). Similar situation will happen in line 5. Remember, creating an instance of InputStream or OutputStream throws an exception, thus you need to either catch it or throw it.