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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
b0gdan_c90
Posts: 1
Joined: Mon Jun 08, 2020 5:09 am
Contact:

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

Post 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.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests