Multiple choice

How many constructors of ConcurrentHashMap class are there in java collections framework?

  1. 8

  2. 7

  3. 6

  4. 5

  5. 4

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

This is the correct choice because there are 5 constructors of ConcurrentHashMap class. These are :- 1) ConcurrentHashMap():- Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16), 2) ConcurrentHashMap(int initialCapacity):- Creates a new, empty map with the specified initial capacity and with default load factor (0.75), and concurrencyLevel (16), 3) ConcurrentHashMap(int initialCapacity, float loadFactor):- Creates a new, empty map with the specified initial capacity and load factor and with the default concurrencyLevel (16), 4) ConcurrentHashMap(int initialCapacity, float loadFactor, int concurrencyLevel):- Creates a new, empty map with the specified initial capacity, load factor and concurrency level, 5) ConcurrentHashMap(Map m):- Creates a new map with the same mappings as the given map.