Question: Examine the following code: Map items = new HashMap < > ( ) ; items.put ( Integer . valueOf ( 1 ) , Tea )

Examine the following code:
Map items = new HashMap<>();
items.put(Integer.valueOf(1),"Tea");
items.put(Integer.valueOf(2),"Cake");
Which statements are true? (Choose two)
items.put(Integer.valueOf(3),"Cake"); will create an additional element with a "Cake" value.
items.put(Integer.valueOf(1),"Coffee"); will replace "Tea" with "Coffee."
items.put(Integer.valueOf(2),"Cake"); will throw an exception.
items.put(Integer.valueOf(3),"Tea"); will replace the integer key value for the "Tea" element.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!