Oracle
1Z0-819 · Question #111
1Z0-819 Question #111: Real Exam Question with Answer & Explanation
The correct answer is A. A java.nio.file.NoSuchFileException is thrown on line 1.. See the full explanation below for the reasoning.
Question
Given the fragment:
Path source = Paths.get("/repo/a.txt");
Path destination = Paths.get("/repo/"); // line 1
Files.delete(destination); // line 2
Files.delete(source); // line 3
Assuming the source file a.txt and the folder /repo exist, what is the result?
Options
- AA java.nio.file.NoSuchFileException is thrown on line 1.
- BA java.nio.file.NoSuchFileException is thrown on line 2.
- CA java.io.IOException occurs and /repo/a.txt is deleted.
- D/repo is removed.
Community Discussion
No community discussion yet for this question.