Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 179

Given the code fragment:

List nL = Arrays.asList("Jim", "John", "Jeff");

Function funVal = s -> "Hello : ".concat(s); nL.Stream()

.map(funVal)

.forEach(s-> System.out.print (s));

What is the result?

    Correct Answer: D

    The code contains a call to nL.Stream(), which is incorrect since method names in Java are case-sensitive and should be in camelCase. The correct method call should be nL.stream(). Therefore, a compilation error occurs due to the incorrect method name.

Discussion
jduarteOption: A

The correct answer A if the sentence nL.Stream().map(funVal) .forEach(s-> System.out.print (s)); change nL.stream().map(funVal) .forEach(s-> System.out.print (s)); . Steam is lower case

asdfjhfgjuaDCVOption: A

A is the correct answer tested..(if in place of for each map will be there then no output.)

steefaandOption: A

A is true assuming Stream is typo.

duydnOption: A

Answer is A. Tested 22/09/2023 nL.Stream() is a typo

Svetleto13Option: A

A,tested