About Question enthuware.ocpjp.v7.2.1212 :

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

Moderator: admin

Post Reply
cesarnda
Posts: 1
Joined: Wed Oct 09, 2013 10:12 pm
Contact:

About Question enthuware.ocpjp.v7.2.1212 :

Post by cesarnda »

This question should give a little more details about why the answer is 4. For what I have understand, the expression "glob:*.java" will not cross directories, so it will only match the file a.java. If we want to match all of the files in the sub directories, we should use "glob:**.java".


Thanks

Damo2k
Posts: 3
Joined: Fri Jan 24, 2014 6:37 pm
Contact:

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

Post by Damo2k »

Curious about this one too.

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

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

Post by admin »

It is not the glob pattern that is making it cross the directories. It is the Files.walkFileTree method that makes it travel each level under the given path. The glob pattern only matches *.java in the same directory.

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

Damo2k
Posts: 3
Joined: Fri Jan 24, 2014 6:37 pm
Contact:

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

Post by Damo2k »

Cheers, thanks for your explanation.

fariz.siracli
Posts: 22
Joined: Mon Jul 06, 2015 11:45 am
Contact:

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

Post by fariz.siracli »

But how can we say it will cross directory or not by looking at walkFileTree method ? what is essence in this question?

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

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

Post by admin »

We can say that by go through the JavaDoc API description of walkFileTree method.
If you like our products and services, please help us by posting your review here.

jabenitez
Posts: 9
Joined: Tue Apr 17, 2018 5:03 am
Contact:

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

Post by jabenitez »

What is the difference between Files.walk() and Files.walkFileTree() methods?

Thanks in advance.

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

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

Post by admin »

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

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests