Share on Google+Share on Google+

SCJP Module-9 Question-12

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




The 'null' reference key is NOT permitted in "Map".


Posted on: July 17, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null