Page 1 of 1

About Question enthuware.ocpjp.v8.3.1918 :

Posted: Sun Aug 28, 2016 7:55 am
by ramy6_1
Hello ,

In description of "enthuware.ocpjp.v8.3.1920" , you mentioned that Files.walk walks the directory in a depth first manner, which means, it processes the children of a directory first before moving to the sibling of the directory.

Accordingly the correct answer should be

a
a/b
a/b/parent
a/a.java

which is different that the selected correct answer option 4.

Kindly clarify.

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

Posted: Sun Aug 28, 2016 9:55 pm
by admin
parent is not a real directory inside b. It is a symbolic link. The first line of the explanation says, "///Files.walk/// method does not follow symbolic links by default.", so there is no reason why it will print a/b/parent after a/b.

HTH,
Paul.

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

Posted: Mon Aug 29, 2016 4:47 am
by ramy6_1
Hello ,
Thanks for your response.

Regardless the parent itself.

Files.walk walks the directory in a depth first manner which means a/b should be processed before a/a.java and that is different than your selected correct answer.

Kindly clarify.

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

Posted: Mon Aug 29, 2016 9:17 pm
by admin
Your interpretation of depth first is incorrect. Depth first simply means it will first process the whichever item it picks first, fully before moving to the next sibling. It doesn't imply anything about ordering. a/b and a/a.java are at the same level. There is no guarantee which one will be picked first. What is guaranteed is that whenever a/b is picked, it will process a/b completely (i.e. it will go inside a/b) before moving to a/a.java.

I will suggest you to google "depth first algorithm" to get a more clear understanding.
HTH,
Paul.

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

Posted: Sat Sep 03, 2016 5:03 am
by ramy6_1
You are right.
Thanks for clarification.