Multiple choice

Which of the following methods of the Map.Entry interface throws ClassCastException?

  1. Object getKey()

  2. Object getValue()

  3. int hashCode()

  4. Object setValue(Object v)

  5. None of the above

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

This method is used to set the map for this map entry to v and can throw ClassCastException, if v is not the correct type for the map.