The finally statement is always executed right ? If Line 6 throws an IOException, after catching it, does the JVM try line 13. If so would it not throw a null pointer exception if we assume the out variable in LIne 6 was never initialized?
it SHOULD throw an NPE if line 6 fails. The IOException is thrown on line 6, leading to the catch executing. After that, the finally block is executed yielding the NPE because out is null (which is the result when the constructor fails). So you would get first a notice "IO Error." followed on the next line by "NullPointerException at line 13". Compiler doesn't check for NPE and other RuntimeExceptions (which is of course why it's called RunTimeException). A better way to write line 13 would therefore be