fork download
  1.  
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class MyTreeMapRead {
  8. public static void main(String a[]){
  9. TreeMap<String, String> hm = new TreeMap<String, String>();
  10. hm.put("first", "FIRST INSERTED");
  11. hm.put("second", "SECOND INSERTED");
  12. hm.put("third","THIRD INSERTED");
  13. System.out.println(hm);
  14. Set<String> keys = hm.keySet();
  15. for(String key: keys){
  16. System.out.println("Value of "+key+" is: "+hm.get(key));
  17. }
  18. }
  19. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
{first=FIRST INSERTED, second=SECOND INSERTED, third=THIRD INSERTED}
Value of first is: FIRST INSERTED
Value of second is: SECOND INSERTED
Value of third is: THIRD INSERTED