Hello all, my question comes up right after i finished the
test after NIO2 chapter (9) in the OCP Study Guide by Boyarski and Selikoff. As there are multiple methods that potentially throw a checked IOException , i got confused in some answers as it appears the potential exceptions are not taken into consideration.
Examples : question 6 uses a Files.walk() method , but has no try/catch, question 17 uses .toRealPath() which no try/catch , isSameFile() in multiple other questions and so on .So basically i realized my expectation is different than what the questions are actually about.
So i have 2 questions :
1. Best way to determine whether i should care for checked exceptions handling or not on a question?
2. If there is a compilation error due to not handled exception , what line should it it be marked on? The line where the method is , the line where its encompassing method is, or somewhere else( in case the lines a remarked //1 //2 and so on and there is a choice)? It should be the the one the compiler shows, but just to be sure.
Thanks