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.


Correct Option: A

Find more quizzes: