What are the changes to be made for the below code to print the string 12345?

Stream.iterate(1, x -> x++).limit(5).map(x -> x).collect(Collectors.joining());

A. Change Collectors.joining() to Collectors.joining("").
B. Change map(x -> x) to map(x -> "" + x) .
C. Change x -> x++ to x -> ++x.
D. Add forEach(System.out::print) after the call to collect().

 Option B,C

 Option A,C

 Option A,B

 Option B, D

Verified Answer
Correct Option - a

To get all Infosys Certified Java SE8 Professional Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in