I have a problem with the answer to question 17. Option D is marked as an incorrect answer "since line K3 by itself does not cause any compilation issues".
This line does however fail to compile on its own, even when all the other problems are corrected, because of the unhandled java.io.IOException.
Could you please revise and shed some light? Thank you.
Notice how the code in question 17 isn't inside a method. This means you get to assume the code around it is correct; in this case that the relevant checked exception is declared. The example at the top of xxiv illustrates this.
This techniques shows up on the exam so you can focus on the relevant code rather than making sure the correct exceptions are handled or declared in each and every example.
Thanks for the explanation, it does make sense. "For code snippets, you can assume that all necessary surrounding code is implied." Keeps us on our toes