nerdexam
Oracle

1Z0-809 · Question #263

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

The correct answer is D. A compilation error occurs at line n2.. See the full explanation below for the reasoning.

Question

Given the code fragments: interface CourseFilter extends Predicate<String> { public default boolean test (String str) { return str.contains ("Java"); } } List<String> strs = Arrays.asList("Java", "Java EE", "Embedded Java"); Predicate<String> cf1 = s -> s.length() > 3; //line n1 private cf2 = new CourseFilter(); //line n2 public boolean test (String s) { return s.startsWith ("Java"); } }; long c = strs.stream() .filter(cf2) .filter(cf1) .count(); System.out.println(c); What is the result?

Options

  • A2
  • B3
  • CA compilation error occurs at line n1.
  • DA compilation error occurs at line n2.

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice