About Question enthuware.ocpjp.v7.2.1605 :

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

Moderator: admin

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

About Question enthuware.ocpjp.v7.2.1605 :

Post by sir_Anduin@yahoo.de »

Hi,

I cant fugure out what resolving means.
could you make an example?

I tried some path combination like in the question, but i dont understand what the method is doing. (besides: If the other parameter is an absolute path then this method trivially returns other. If other is an empty path then this method trivially returns this path)

Thanks

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

Re: About Question enthuware.ocpjp.v7.2.1605 :

Post by admin »

To understand resolve, it would be easier if you understand relativize first because resolve is the opposite of relativize. With respect to paths, relativise basically means, reaching the target (i.e. argument) directory from the source (i.e. this), directory. For example, lets say you are on a command/shell prompt and you are currently in /user/a/b/c. Now, how will you go to /user/a/b/c/d?
You will just do "cd d", right? That means relative to "/user/a/b/c", the path "/user/a/b/c/d" is just "d".

Therefore, "/user/a/b/c".relativize("/user/a/b/c/d") should give you just "d".

Resolve is opposite of the above process. "/user/a/b/c".resolve("d") will give you "/user/a/b/c/d".

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

xavier_devm
Posts: 1
Joined: Tue Jul 04, 2023 10:51 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1605 :

Post by xavier_devm »

explanation for option 4 says
When the argument to resolve starts with the root (such as c: or, on *nix, a /), the result is same as the argument
but the general explanation says
Where the given path has a root component then resolution is highly implementation dependent and therefore unspecified.
which is contradictory. I think the explanation for option 4 should be
When the argument to resolve is an absolute path, the result is same as the argument
Reference: https://stackoverflow.com/questions/188 ... ath-method

Personally, I can't see a possible scenario for a path with a root component not being an absolute path, by the way

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

Re: About Question enthuware.ocpjp.v7.2.1605 :

Post by admin »

This is taken directly from the JavaDoc API description for resolve.


I don't think it is contradictory. There are two scenarios -
1. "If the other parameter is an absolute path then this method trivially returns other. "
This means the "other" path starts with a c: or / (or whatever makes the path absolute on that system).

2. " Where the given path has a root component then resolution is highly implementation dependent and therefore unspecified."
I believe that this means the "other" path contains a root component for example /a1/c:/a2. In this case the result is "highly implementation dependent and therefore unspecified"

HTH,
Paul.
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 225 guests