Answer Posted / srikanth
package com.sri;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
public class entry {
public static void main(String[] args) {
try{
HashMap<Integer,Integer>tm=new
HashMap<Integer,Integer>();
tm.put(100,200);
tm.put(200,101);
tm.put(600,700);
tm.put(700,103);
tm.put(900,104);
Set s=tm.entrySet();
Iterator it=s.iterator();
while(it.hasNext()){
Map.Entry me=(Map.Entry)it.next();
System.out.println(me.getKey()
+"......"+me.getValue());
}
}catch(Exception e){
e.printStackTrace();
}
}
}
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Can this keyword be used to refer static members?
What is java thread dump, how can we get java thread dump of a program?
What is the difference between instanceof and isinstance?
What is application tier?
What methodology can be employed to locate substrings inside a string?
Explain importance of finally block in java?
Can we declare an interface as final?
Why is it important to initialize a variable?
why an outer class cannot be declared as private?
How to access arraylist elements in java?
Can we overload destructor in java?
What is method in java with example?
What kind of variables a class can consist of?
What is a flag value?
Explain the difference between transient and volatile in java?