The method ________ is used to remove all the mappings from a Map.

  • clear()
  • eraseAll()
  • removeAll()
  • removeMappings()
In Java, the clear() method is used to remove all the mappings from a Map. It does not remove the map itself but makes it empty, removing all key-value pairs. The other options do not perform this specific function.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *