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.
About Question enthuware.ocpjp.ii.v11.2.1801 :
Moderator: admin
-
- Posts: 1
- Joined: Mon Jun 08, 2020 5:09 am
- Contact:
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.ii.v11.2.1801 :
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.
hello,world
hello,world
and it is correct. Please confirm if you see something else.
Who is online
Users browsing this forum: Bing [Bot] and 7 guests