The implementation provided in the explanation will only work for leaves in the directory tree, but not for any directory that contains sub directories, because the count variable is reset every time it enters a new directory.
from the javadoc:
postVisitDirectory(T dir, IOException exc)
Invoked for a directory after entries in the directory, *and all of their descendants,* have been visited.
BTW in general the questions and explanations are usually very good, i am very satisfied , thanks
About Question enthuware.ocpjp.v8.2.1652 :
Moderators: Site Manager, fjwalraven
-
- Posts: 3
- Joined: Thu Aug 25, 2016 4:36 am
- Contact:
Online
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1652 :
Hi,
Are you sure enthuware.ocpjp.v8.2.1652 is correct question id because I couldn't find any question by this id?
Paul.
Are you sure enthuware.ocpjp.v8.2.1652 is correct question id because I couldn't find any question by this id?
Paul.
-
- Posts: 3
- Joined: Thu Aug 25, 2016 4:36 am
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1652 :
Hi,
Yes the questionbank is com.enthuware.ets.ocp-jp.upgrade.1z0-813, question id enthuware.ocpjp.v8.2.1652
If it helps, here is the text of the question: "You need to recursively traverse through a given directory structure. After visiting each directory, you want print the number of files visited in that directory. Which three methods of FileVisitor will be helpful in implementing this requirement?"
Bruno
Yes the questionbank is com.enthuware.ets.ocp-jp.upgrade.1z0-813, question id enthuware.ocpjp.v8.2.1652
If it helps, here is the text of the question: "You need to recursively traverse through a given directory structure. After visiting each directory, you want print the number of files visited in that directory. Which three methods of FileVisitor will be helpful in implementing this requirement?"
Bruno
Online
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1652 :
OK, I got it.
You are right. The example has issues. I have removed it.
thank you for your feedback!
Paul.
You are right. The example has issues. I have removed it.
thank you for your feedback!
Paul.
Who is online
Users browsing this forum: No registered users and 2 guests