exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 28 discussion

Actual exam question from Oracle's 1z0-809
Question #: 40
Topic #: 2
[All 1z0-809 Questions]

/green.txt and /colors/yellow.txt are accessible, and the code fragment:

Given that -
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?
green.txt file content is replaced by the yellow.txt file content and the yellow.txt file is deleted.

  • A. The yellow.txt file content is replaced by the green.txt file content and an exception is thrown.
  • B. The green.txt is moved to the /colors directory.
  • C. The file FileAlreadyExistsException is thrown at runtime.
  • D. A
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Innovation
Highly Voted 4 years, 5 months ago
The yellow.txt file content is replaced by the green.txt file content Then a NoSuchFileException is thrown. because cant find the source file to delete.
upvoted 5 times
...
DarGrin
Most Recent 3 days, 21 hours ago
Selected Answer: A
Files.delete(source); - here commes exception, because source does not exists any more
upvoted 1 times
...
steefaand
4 months ago
Selected Answer: A
A is correct.
upvoted 1 times
...
iSnover
4 months ago
Selected Answer: A
The answer is A. The yellow.txt file content is replaced by the green.txt file content. Then a NoSuchFileException is thrown, because cant find the source file to delete.
upvoted 1 times
...
AVB22
2 years, 7 months ago
A tested
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago