Simon vJ

Greenhorn
+ Follow
since Jun 13, 2021
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Simon vJ

 Hi Coderanchers.

I am currently learning for my 1Z0-819 or 1Z0-817 (still unsure which one to take, I hold an SCJP-6)

When taking the review questions for NIO.2 today I encountered some possible inconsistencies, which I am not able
to clarifiy for myself:

The questions that really confuse me are the second, third and sixth (pages 1014 and 1015):

The second question ist just a code fragment of a method:

The answer: The code does not compile because of the checked exception by Files.deleteIfExists(path)

The third question contains line numbers...

A given choice to answer is (B) that the code will not compile beacuse of the line 5. But in the answers in the appendix that choice is not valid.
So I assume because that code fragment has line numbers the exception could be declared or captured on another line?


When reading the code fragment of the sixth question I got even more confused:


The second line would not compile since Files.walk(..) throws an IOException and needs to be handled with...
But again (like in Question 3) that is not an option in the possible answers. Is it because its a try-with-resources statement?


In Summary:

  Code fragments WITHOUT line numbers...
  Do I just have to look for checked Exceptions if there is a whole method which has a missing throws declaration?

  Code fragments WITH line numbers...
  Can I assume that Exceptions are dealt with when ther are missing line numbers?


And what happens in the real exam? Are there code fragments with numbers and without?


Hope you guys can help me :-)

Cheers, Smon