Multiple choice

Find out the true statements.

i. HashMap allows null values in a key value pair. ii. HashMap does not allow null values in a key value pair. iii. Hashtable allows null values in a key value pair. iv. Hashtable does not allow null values in a key value pair.

  1. i. and iii. are true

  2. i. and iv. are true

  3. ii. and iii. are true

  4. ii. and iv. are true

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

This answer is correct. HashMap allows null in the key value pairs. It can have null in the key as well as values. Hashtable does not allow null in the key value pairs. It will not have any null in the key or value pairs.