About Question enthuware.ocpjp.v8.2.1887 :

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

Moderator: admin

Post Reply
shoutcol
Posts: 2
Joined: Tue May 23, 2017 3:56 am
Contact:

About Question enthuware.ocpjp.v8.2.1887 :

Post by shoutcol »

... Each subdirectory contains several files but there is exactly one regular file named test.txt within the whole directory structure...
In fact there could be a second file within the directory structure named "mytest.txt"

The correct answer uses the

Code: Select all

endsWith("test.txt")
method to check the file existance. In this case both files would match the criteria. This is very confusing.

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

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

Post by admin »

The problem statements requires that the code should print the full path of test.txt. The code in the option does that. Yes, that code will also print full path of mytest.txt but that is fine because the problem statement does not require that path for only test.txt should be printed.
If you like our products and services, please help us by posting your review here.

shoutcol
Posts: 2
Joined: Tue May 23, 2017 3:56 am
Contact:

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

Post by shoutcol »

Ok, but then i don't understand why it is important that is has exactly one regular test.txt file in the directory structure. If there were multiple test.txt, still the same answer would be correct.

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

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

Post by admin »

Yes, but not everything given in the problem statement is necessarily important for the answer. In fact, you may find questions in the exam that seem to be about one thing but are actually about something entirely different.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

__JJ__
Posts: 125
Joined: Thu Jul 05, 2018 6:44 pm
Contact:

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

Post by __JJ__ »

FWIW only Files.list requires the path argument to be a directory.

Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests