nerdexam
Oracle

1Z0-819 · Question #49

1Z0-819 Question #49: Real Exam Question with Answer & Explanation

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

Question

Assuming that Widget class has a getPrice method t is code does not compile: List widgets = List.of( new Widget("Basic Widget", 19.55), // line 1 new Widget("Enhanced Widget", 35.00), new Widget("Luxury Edition Widget", 55.45)); Stream widgetStream = widgets.stream(); // line 4 widgetStream.filter(w -> w.getPrice() > 20.00) .forEach(System.out::print); // line 5 Which two statements, independently, would allow this code to compile? (Choose two.)

Options

  • AReplace line 5 with widgetStream.filter(w -> ((Widget)w).getPrice() > 20.00).
  • BReplace line 5 with List<Widget> widgetStream = widgets.stream();.
  • CReplace line 4 with Stream<Object> widgetStream = widgets.stream();.
  • DReplace line 4 with Stream<Widget> widgetStream = widgets.stream();.

Unlock 1Z0-819 to see the answer

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