Multiple choice technology programming languages

Which is simplest code snippet you will add in the main function to set the name attribute of 50th in the ItemList to “Done”?

  1. im.name = "Done";

  2. Item otherObject = new Item(“Done”); itemList.set(49, otherObject);

  3. ((Item)itemList.get(49)).name = “Done”;

  4. None of above is correct as they are not changing 50th element.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The simplest way to change an attribute of an object inside a list is to retrieve it and directly modify its field. im.name = "Done"; directly updates the reference if im points to the 50th element.