About Question enthuware.ocpjp.v11.2.3335 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
edufin166@yahoo.com
Posts: 24
Joined: Wed Sep 28, 2022 9:41 am
Contact:

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

Post by edufin166@yahoo.com »

Hello, one doubt..

In the code:

Path p1 = Paths.get("c:\\temp\\src\\foo.bar\\module-info.java");
Path p2 = Paths.get("c:\\temp\\out\\foo.bar"); //foo.bar is a folder
Files.move(p1, p2, REPLACE_EXISTING );

Question 01: The file "module-info.java" would be copied "overwriting" on top "foo.bar", even IF the foo.bar folder was "not-empty"?
Question 02: The file "module-info.java" would be copied "overwriting" on top "foo.bar", even IF the foo.bar folder was "empty"?

Thanks
Last edited by edufin166@yahoo.com on Fri Jun 09, 2023 1:54 pm, edited 1 time in total.

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

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

Post by admin »

If you try to copy module-info.jar onto foo.bar, then the JavaDoc API doesn't define what will happen.
On my windows machine it throws FileAlreadyExistsException.
You may read more about it here: https://docs.oracle.com/en/java/javase/ ... CopyOption...)

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests