nerdexam
Oracle

1Z0-809 · Question #263

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"…

The correct answer is D. A compilation error occurs at line n2. You've hit your session limit · resets 5:20pm (America/New_York)

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.

How the community answered

(27 responses)
  • A
    7% (2)
  • B
    19% (5)
  • C
    4% (1)
  • D
    70% (19)

Explanation

You've hit your session limit · resets 5:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice