Page 1 of 1

About Question enthuware.ocpjp.v11.2.3324 :

Posted: Mon Mar 29, 2021 6:59 am
by olakesh
Hi,
Please can you kindly help clarify this question. (Please see attached).
Explanation ended up saying a count of 3 is printed and that was what I chose but the right answer is chosen as 3573

Re: About Question enthuware.ocpjp.v11.2.3324 :

Posted: Tue Mar 30, 2021 6:00 am
by admin
Actually, the explanation does contain a note about the peek method, which is what is generating the first 357 in the output.

Explanation has now been enhanced to make it more clear.
Observe the invocation of the peek method in the stream pipeline. The peek method does not remove any element from the stream. It simply performs the given operation (System.out.print, in this case) for each of the elements (which prints 3, 5, and 7). The resulting stream contains the same elements as the original stream on which peek is invoked.

Finally, count returns 3, which is printed by the last println statement. Thus, the output is 3537.
thank you for your feedback!

Re: About Question enthuware.ocpjp.v11.2.3324 :

Posted: Wed Apr 21, 2021 2:51 pm
by uisang
At the end of the explanation, "Thus, the output is 3537" should be "Thus, the output is 3573" :cheers:

Re: About Question enthuware.ocpjp.v11.2.3324 :

Posted: Wed Apr 21, 2021 10:56 pm
by admin
Right! Fixed.
thank you for your feedback!