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 we modify the throws clause of the superclass method while overriding it in the subclass?
What is constructor and virtual function? Can we call a virtual function in a constructor?
Give me some null interfaces in java?
What is serialversionuid?
Why strings in java are called as immutable?
What is sortedmap in java?
Can we override the static method?
Explain listiterator and methods in listiterator?
What types of index data structures can you have in java?
What is supplier in java?
What is meant by flickering?
When can you say a graph to be a tree?
What are the data types supported by java? What is autoboxing and unboxing?
Which collection allows duplicate values in java?
What is array and arraylist in java?