Review Questions

11.9 Which of these methods can be called on objects implementing the Map interface?

Select the two correct answers.

  1. contains(Object o)

  2. addAll(Collection c)

  3. remove(Object o)

  4. values()

  5. toArray()

11.10 Which statements are true about maps?

Select the two correct answers.

  1. The return type of the values() method is Set.

  2. Changes made in the set view returned by keySet() will be reflected in the original map.

  3. The Map interface extends the Collection interface.

  4. All keys in a map are unique.

  5. All Map implementations keep the keys sorted.

11.11 Which sequence of digits will the following program print?
 import java.util.*; public class Lists { public ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.