Assuming that the file /data/december/log.txt does not exist and given the code fragment:
What is the result?
Assuming that the file /data/december/log.txt does not exist and given the code fragment:
What is the result?
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.
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
D, tested
A FileAlreadyExistsException is thrown at run time
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
Correct answer is D.
Assuming that the file /data/december/log.txt does not exist so answer is D