Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.1801 :

Posted: Mon Jun 08, 2020 5:14 am
by b0gdan_c90
What will the following code print when compiled and run?
List<StringBuilder> messages = Arrays.asList(new StringBuilder(), new StringBuilder());
messages.stream().forEach(s->s.append("helloworld"));
messages.forEach(s->{
s.insert(5,","); System.out.println(s);
});

Your correct answer is
"helloworld
helloworld".

But this is wrong..

Q12 of Test 3.

Re: About Question enthuware.ocpjp.ii.v11.2.1801 :

Posted: Mon Jun 08, 2020 5:24 am
by admin
I see option 4 is set as the correct answer i.e.
hello,world
hello,world

and it is correct. Please confirm if you see something else.