Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 23

Assuming that the file /data/december/log.txt does not exist and given the code fragment:

What is the result?

    Correct Answer: D

    The code attempts to copy the file /data/december/log.txt to the /data directory. However, since the source file /data/december/log.txt does not exist, a NoSuchFileException will be thrown at runtime. This exception is specifically used to indicate that an attempt was made to access a file that does not exist in the file system.

Discussion
maslacOption: D

D is correct. Path java.nio.file.Files.copy(Path source, Path target, CopyOption... options) throws IOException NoSuchFileException - thrown when source file does not exist FileAlreadyExistsException - thrown when target file already exist

JME_CHGOption: D

D, tested

Peacock

A FileAlreadyExistsException is thrown at run time

iSnoverOption: D

D is correct. Path java.nio.file.Files.copy(Path source, Path target, CopyOption... options) throws IOException NoSuchFileException - thrown when source file does not exist FileAlreadyExistsException - thrown when target file already exist

r1muka5Option: D

Correct answer is D.

kartaOption: D

Assuming that the file /data/december/log.txt does not exist so answer is D