About Question enthuware.ocpjp.v8.2.1864 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
mihai_d
Posts: 1
Joined: Tue Nov 17, 2015 1:18 pm
Contact:

About Question enthuware.ocpjp.v8.2.1864 :

Post by mihai_d »

Answer appears to be wrong for this question:

Code: Select all

Map<String, Integer> map1 = new HashMap<>(); 
map1.put("a", 1); 
map1.put("b", 1); 
map1.merge("b", 1, (i1, i2)->i1+i2); 
map1.merge("c", 3, (i1, i2)->i1+i2); 
System.out.println(map1);
Quiz says it will throw NullPointerException at runtime
However, running the code results in:
{a=1, b=2, c=3}
No hint in the documentation either as to why it would throw NPE in this case.

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

Re: About Question enthuware.ocpjp.v8.2.1864 :

Post by admin »

You are right but I see that option 1 ({a=1, b=2, c=3}) is indeed marked as correct not option 4 (NPE).

MichaelZett
Posts: 21
Joined: Wed Dec 10, 2014 8:28 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1864 :

Post by MichaelZett »

A really small thing: the font for the 1st answer seems to be smaller than the others,

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

Re: About Question enthuware.ocpjp.v8.2.1864 :

Post by admin »

Fixed.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests