nerdexam
Oracle

1Z0-809 · Question #275

QUESTION 299 Given the code fragment: List<String> str = Arrays.asList("pen", "is", "not", "a", "pencil"); if (name.length () < 60) { throw new UserException (); } else if (age > 60) { throw new…

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

Question

QUESTION 299 Given the code fragment: List<String> str = Arrays.asList("pen", "is", "not", "a", "pencil"); if (name.length () < 60) { throw new UserException (); } else if (age > 60) { throw new AgeOutOfLimitException (); } else { System.out.println("User is registered."); } 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:pen
  • D0:1:2:3:4:
  • EA compilation error occurs.

How the community answered

(40 responses)
  • A
    3% (1)
  • B
    8% (3)
  • C
    3% (1)
  • D
    15% (6)
  • E
    73% (29)

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