Page 1 of 1
About Question enthuware.ocpjp.v8.2.1887 :
Posted: Tue May 23, 2017 4:10 am
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
method to check the file existance. In this case both files would match the criteria. This is very confusing.
Re: About Question enthuware.ocpjp.v8.2.1887 :
Posted: Tue May 23, 2017 4:41 am
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.
Re: About Question enthuware.ocpjp.v8.2.1887 :
Posted: Tue May 23, 2017 6:44 am
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.
Re: About Question enthuware.ocpjp.v8.2.1887 :
Posted: Tue May 23, 2017 6:55 am
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.
Re: About Question enthuware.ocpjp.v8.2.1887 :
Posted: Wed Aug 01, 2018 8:04 am
by __JJ__
FWIW only Files.list requires the path argument to be a directory.