Home Tutorial Java Scjp Part9 SCJP Module-9 Question-12

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-12
Posted on: July 17, 2010 at 12:00 AM
Advertisement
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

Answer

(1)

Explanation

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

Advertisement

Related Tags for SCJP Module-9 Question-12:


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.

Posted on: July 17, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com