Oracle
1Z0-805 · Question #7
1Z0-805 Question #7: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #7. The question stem and answer options stay visible for context.
Question
View the Exhibit: Given the following code fragment: class Finder extends SimpleFileVisitor<Path> { private final PathMatcher matcher; private static int numMatches = 0; Finder() { matcher = FileSystems.getDefault().getPathMatcher("glob:*java"); } void find(Path file) { Path Name = file.getFileName(); if (name != null && matcher.matches(name)) { Oracle 1Z0-805 Exam numMatches++; } } void report() { System.out.println("Matched: " + numMatches); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { find(file); return CONTINUE; } } public class Visitor { public static void main(String[] args) throws IOException { Finder finder = new Finder(); Files.walkFileTree(Paths.get("d:\Project"), finder); finder.report(); } } What is the result?
Exhibit
Options
- ACompilation fails
- B6
- C4
- D1
- E3
Unlock 1Z0-805 to see the answer
You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
