Oracle Java SE 8 Programmer II 1z0-809 Question # 3 Topic 1 Discussion

Oracle Java SE 8 Programmer II 1z0-809 Question # 3 Topic 1 Discussion

1z0-809 Exam Topic 1 Question 3 Discussion:
Question #: 3
Topic #: 1

Given the code fragment:

List str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”);

Predicate 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?


A.

0 : 0 : pen


B.

0 : 1 : pen


C.

0 : 0 : 0 : 0 : 0 : pen


D.

0 : 1 : 2 : 3 : 4 :


E.

A compilation error occurs.


Get Premium 1z0-809 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.