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

Oracle Certified Foundations Associate Java Certification Questions and Discussion
1Z0-811

Moderator: admin

Post Reply
dongyingname
Posts: 18
Joined: Sat Jun 22, 2019 4:10 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

sir_Anduin@yahoo.de
Posts: 62
Joined: Fri Aug 07, 2015 2:16 pm
Contact:

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

Post 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...)

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

You are right, the part "or is a symbolic link" should not be there. Fixed.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Artuwok
Posts: 7
Joined: Tue Aug 20, 2019 1:32 am
Contact:

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

Post by Artuwok »

Hi. I think it's not fixed
Attachments
Screenshot.png
Screenshot.png (67 KiB) Viewed 4979 times

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests