Multiple choice

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

  1. 6

  2. 5

  3. 4

  4. 3

  5. 2

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

This is the correct answer, as there are 5 constructors of LinkedHashMap class. These are:- LinkedHashMap():- constructs an empty insertion-ordered LinkedHashMap instance with the default initial capacity (16) and load factor (0.75), LinkedHashMap(int initialCapacity):- constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and a default load factor (0.75), LinkedHashMap(int initialCapacity, float loadFactor):-  constructs an empty insertion-ordered LinkedHashMap instance with the specified initial capacity and load factor. LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder):- constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode, and LinkedHashMap(Map<? extends K,? extends V> m):-  constructs an insertion-ordered LinkedHashMap instance with the same mappings as the specified map.