About Question enthuware.ocpjp.v8.2.1805 :
Posted: Thu Mar 03, 2016 4:19 pm
Regarding the note:
Assume the move operation will succeed? Or do you mean disregard the ATOMIC_MOVE copy option and evaluate the call to move() on its own merits, as if it didn't have the ATOMIC_MOVE copy option? In this question, for example, the two paths don't locate the same file, so the operation would fail. The API for Files.move() states that:NOTE: Some candidates have reported being tested on StandardCopyOption.ATOMIC_MOVE. Unfortunately, it is not clear whether the exam tests on the implementation dependent aspect of this option. If you get a question on it and the options do not contain any option referring to its implementation dependent nature, we suggest the following: Assume that the move operation will succeed and then the delete operation will throw a java.nio.file.NoSuchFileException.
In this case, Files.isSameFile(p1, p2) returns false, so the move operation would fail.By default, this method attempts to move the file to the target file, failing if the target file exists except if the source and target are the same file, in which case this method has no effect.