Oracle
1Z0-809 · Question #1
Given that /green.txt and /colors/yellow.txt are accessible, and the code fragment: ``java Path source = Paths.get("/green.txt"); Path target = Paths.get("/colors/yellow.txt"); Files.move(source, targ
The correct answer is B. The yellow.txt file content is replaced by the green.txt file content and an exception is thrown.. See the full explanation below for the reasoning.
Question
Given that /green.txt and /colors/yellow.txt are accessible, and the code fragment:
Path source = Paths.get("/green.txt");
Path target = Paths.get("/colors/yellow.txt");
Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);
Files.delete(source);
Which statement is true?Options
- AThe green.txt file content is replaced by the yellow.txt file content and the yellow.txt file is deleted.
- BThe yellow.txt file content is replaced by the green.txt file content and an exception is thrown.
- CThe file green.txt is moved to the /colors directory.
- DA FileAlreadyExistsException is thrown at runtime.
How the community answered
(39 responses)- A15% (6)
- B72% (28)
- C8% (3)
- D5% (2)
Community Discussion
No community discussion yet for this question.