Yes, you can store a null key in a HashMap. Here’s how it handles it:

  1. Allows One null Key: A HashMap permits only one null key because keys must be unique.

  2. Storage Mechanism: The null key is handled specially:

    • It doesn’t calculate a hash code (since null has no hash value).

    • It is always stored in the first bucket (index 0).

In short: HashMap supports one null key and stores it in a predefined way.