The sample example given below will test your understanding of EnumMap in Java.
The sample example given below will test your understanding of EnumMap in Java.Given below the sample code :
11 EnumMap< Integer> frequencyEnumMap = new EnumMap< Integer>(ordinaryMap);
12 frequencyEnumMap.put(null, 100);
13 System.out.println("Frequency EnumMap: " + frequencyEnumMap);
What will be the output of the above code ?
1. compile error
2. 100
3. null
4. NullPointerException
(1)
The 'null' reference key is NOT permitted in "Map".