Multiple choice

How many constructors of WeakHashMap are there in Java collections Framework?

  1. 6

  2. 5

  3. 4

  4. 3

  5. 2

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

This is the correct answer, there are four constructors of WeakHashMap in java. These are: 1) WeakHashMap(): Constructs a new, empty WeakHashMap with the default initial capacity (16) and load factor (0.75). 2) WeakHashMap(int initialCapacity):-Constructs a new, empty WeakHashMap with the given initial capacity and the default load factor (0.75). 3) WeakHashMap(int initialCapacity, float loadFactor):-Constructs a new, empty WeakHashMap with the given initial capacity and the given load factor. 4) WeakHashMap(Map m): Constructs a new WeakHashMap with the same mappings as the specified map. So, this is the correct answer.