Multiple choice

Which of the following exceptions might the method int compare(Object obj1, Object obj2) throw in java collection framework?

  1. ClassCastException

  2. IllegalArguementException

  3. InvalidArguementException

  4. Both (1) and (2)

  5. None of the above

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

Yes, this method can throw this exception, if the types of the objects are not compatible for comparison.