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

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-13
Posted on: July 17, 2010 at 12:00 AM
Advertisement
The Sample code given below will test your knowledge of HashMap of Collection framework in Java.

Given below the sample code :

4. HashMap hm = new HashMap();
5. hm.put("key45", "some value");
6. hm.put("key12", "some other value");
7. hm.put("key39", "yet another value");
8. Set a = hm.keySet();
9. // insert code here

What code should be at line 9 to sort the keys in HashMap "hm"?

1. a = new SortedSet(a) ;

2. Collections.sort(a);

3. a = new TreeSet(a);

4. a = Collections.sort(a);

Answer

(3)

Advertisement

Related Tags for SCJP Module-9 Question-13:


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