Home » JAVA Programming » Collections » Question
  1. Which of these method is used add an element and corresponding key to a map?
    1. redo()
    2. add()
    3. set()
    4. put()
    5. None of these
Correct Option: D

Maps revolve around two basic operations – get() and put(). to put a value into a map, use put(), specifying the key and the value. To obtain a value, call get() , passing the key as an argument. The value is returned.



Your comments will be displayed only after manual approval.