nerdexam
Oracle

1Z0-809 · Question #222

1Z0-809 Question #222: Real Exam Question with Answer & Explanation

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

Question

Given the code fragment: List<Integer> prices = Arrays.asList(3, 4, 5); prices.stream() .filter(e -> e > 4) .peek(e -> System.out.print ("Price " + e)) // line n1 .map(e -> e + 1) // line n2 .peek(n -> System.out.println ("New Price " + n)); // line n3 Which modification enables the code to print Price 5 New Price 4?

Options

  • AReplace line n2 with .map (n -> System.out.println ("New Price" + n ?)) and remove line n3
  • BReplace line n2 with .mapToInt (n -> n ?!) ;
  • CReplace line n1 with .forEach (e -> System.out.print ("Price" + e))
  • DReplace line n3 with .forEach (n -> System.out.println ("New Price" + n));

Unlock 1Z0-809 to see the answer

You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 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-809 Practice