nerdexam
Oracle

1Z0-805 · Question #18

1Z0-805 Question #18: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #18. The question stem and answer options stay visible for context.

Question

Given the code fragment: public static void main(String[] args) { Path dir = Paths.get("d:\company"); // insert code here. Line ** for (Path entry: stream) { System.out.println(entry.getFileName()); } } catch (IOException e) { System.err.println("Caught IOException: " + e.getMessage()); } } Which two try statements, when inserted at line 11, enable you to print files with the extensions.java, .htm, end and .jar.

Options

  • Atry (DirectoryStream<path> stream =Files.newDirectoryStream(dir, "*.{java, htm, jar}")) {
  • Btry (DirectoryStream<path> stream =Files.newDirectoryStream(dir, "*.[java, htm, jar"] }} {
  • Ctry (DirectoryStream<path> stream =Files.newDirectoryStream(dir, ".{java, htm*, jar*}"}} {
  • Dtry (DirectoryStream<path> stream =Files.newDirectoryStream(dir, "**.{java, htm, jar}")) {

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.

Full 1Z0-805 Practice