Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Wed Aug 14, 2019 9:17 pm
by dongyingname

Code: Select all

Path p1 = Paths.get("c:\\temp\\src\\foo.bar\\module-info.java"); //1
Path p2  = Paths.get("c:\\temp\\out\\foo.bar"); //2
Files.move(p1, p2);//3
I am assuming the above code is trying to move module-info.java to c:\temp\out\ directory and rename it to be foo.bar, without an option parameter;
and because a folder named foo.bar already exists, a java.nio.file.FileAlreadyExistsException is thrown.
Is my assumption correct?
I'm getting this because I saw it was a "FileAlreadyExistsException". I'm guessing, using a proper override option, the code will change the c:\temp\out\foo.bar folder into a c:\temp\out\module-info.java file.

Re: About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Wed Aug 14, 2019 10:44 pm
by admin
Correct, that is what the explanation given below option 3 also says.

>I'm guessing, using a proper override option, the code will change the c:\temp\out\foo.bar folder into a c:\temp\out\module-info.java file.
No, a folder cannot be changed to a file. Try it out and see what happens.

Re: About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Sun Sep 08, 2019 4:06 am
by sir_Anduin@yahoo.de
Your explanation on anserwer 3 is
By default, the copy fails if the target file already exists or is a symbolic link...
But according to documentation
If the file is a symbolic link then the symbolic link itself, not the target of the link, is moved.
See
https://docs.oracle.com/en/java/javase/ ... CopyOption...)

Re: About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Sun Sep 08, 2019 4:53 am
by admin
You are right, the part "or is a symbolic link" should not be there. Fixed.
thank you for your feedback!

Re: About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Wed Nov 20, 2019 9:21 am
by Artuwok
Hi. I think it's not fixed

Re: About Question enthuware.ocpjp.ii.v11.2.3335 :

Posted: Wed Nov 20, 2019 10:05 am
by admin
You are right. I see that it has been fixed in the regular 1z0-816 question bank but not in the upgrade question bank 1z0-817. Very sorry about that.
Fixed now.