About Question enthuware.ocpjp.v7.2.1603 :

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

Moderator: admin

Post Reply
doziransky
Posts: 8
Joined: Wed Mar 16, 2016 10:57 am
Contact:

About Question enthuware.ocpjp.v7.2.1603 :

Post by doziransky »

Hi,

I understand everything about this question except one thing.

Where does "file:///" come from?

When I looked at the toUri() method in the java api it said:

"This method constructs an absolute URI with a scheme equal to the URI scheme that identifies the provider. The exact form of the scheme specific part is highly provider dependent."

So isn't it possible this won't start with "file:///"?

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

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

Post by admin »

It is certainly possible that it won't start with file:///. But no other options are given so it is ok to assume that on this particular system it will start with file:/// (if there is no exception, of course).

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

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post by Cannelids »

Re the quote from the API “... an empty path is returned if this path does have a root component and all name elements are redundant" I tried this and do see the root e.g.
Path p1 = Paths.get("c:/x/../y/../z/..");
System.out.println(p1.normalize());
prints "c:" not "" (nothing).
Do you think this might be a typo in the API? Maybe it should read "... does not have a root component ...”?

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

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

Post by admin »

Can you please post the link where you saw this written?
If you like our products and services, please help us by posting your review here.

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post by Cannelids »

The "Returns" section of the full method description in https://docs.oracle.com/javase/7/docs/a ... /Path.html
Same in the descriptive comment in the source code file as seen via NetBeans (Navigate > Go to Source)
(And then reproduced in the Explanation for this Enthuware Q)

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

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

Post by admin »

I see. Yes, it could be a typo.
If you like our products and services, please help us by posting your review here.

Cannelids
Posts: 25
Joined: Thu Jun 01, 2017 2:50 pm
Contact:

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

Post by Cannelids »

Thanks - good to have an opinion from a much more knowledgable source :ugeek:

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests