Which statement is true?

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?

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?

A.
The green.txt file content is replaced by the yellow.txt file content and the yellow.txt file is
deleted.

B.
The yellow.txt file content is replaced by the green.txt file content and an exception is thrown.

C.
The file green.txt is moved to the /colors directory.

D.
A FileAlreadyExistsException is thrown at runtime.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


Berti John

Berti John

B.is correct