About Question enthuware.ocpjp.v8.2.1757 :

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

Moderator: admin

Post Reply
badbishop
Posts: 27
Joined: Fri Jul 22, 2016 9:14 am
Contact:

About Question enthuware.ocpjp.v8.2.1757 :

Post by badbishop »

Why the forward slashes in the task become back slashes in the answer?
I mean, is it a typo or do I miss something?

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

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by admin »

The explanation notes, "Assuming that C:\ is the root of the file system.". The author probably verified the results on windows system. You will see \ instead of / on windows.
-Paul.
If you like our products and services, please help us by posting your review here.

sasisachka
Posts: 1
Joined: Mon Apr 06, 2020 8:57 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by sasisachka »

The answer here doesn't contain a new line, it should be

Code: Select all

/works
/works/ocpjp/code

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

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by admin »

I do see a new line. Could you please post a screen shot of what you see?
test.png
test.png (34.36 KiB) Viewed 1490 times
If you like our products and services, please help us by posting your review here.

yuir12
Posts: 22
Joined: Thu Dec 09, 2021 11:23 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by yuir12 »

Hi, can you please explain method toAbsolutePath()? Does it return result as per initialized value?
i.e.

Path d1 = Paths.get("/works/ocpjp"); -> d1.toAbsolutePath(); will return /works/ocpjp
Path d1 = Paths.get("/works"); -> d1.toAbsolutePath(); will return /works

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

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by admin »

Not necessarily. Please go through this description.
Path toAbsolutePath()
Returns a Path object representing the absolute path of this path.
If this path is already absolute then this method simply returns this path. Otherwise, this method resolves the path in an implementation dependent manner, typically by resolving the path against a file system default directory. Depending on the implementation, this method may throw an I/O error if the file system is not accessible.
If you like our products and services, please help us by posting your review here.

yuir12
Posts: 22
Joined: Thu Dec 09, 2021 11:23 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1757 :

Post by yuir12 »

great, thanks for the expanation!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 39 guests