nerdexam
Oracle

1Z0-809 · Question #20

Given the code fragment: List<String> str = Arrays.asList("my", "pen", "is", "your", "pen"); Predicate<String> test = s -> { int i = 0; boolean result = s.contains ("pen"); System.out.print(i++) +…

The correct answer is A. 0:0:pen. You've hit your session limit · resets 5:20pm (America/New_York)

Question

Given the code fragment: List<String> str = Arrays.asList("my", "pen", "is", "your", "pen"); Predicate<String> test = s -> { int i = 0; boolean result = s.contains ("pen"); System.out.print(i++) + ":" ; return result; }; str.stream() .filter(test) .findFirst() .ifPresent(System.out ::print); What is the result?

Options

  • A0:0:pen
  • B0:1:pen
  • C0:0:0:0:0:pen
  • D0:1:2:3:4:
  • EA compilation error occurs.

How the community answered

(28 responses)
  • A
    71% (20)
  • B
    7% (2)
  • C
    14% (4)
  • D
    4% (1)
  • E
    4% (1)

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