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
Why we use set in java?
What is java util function?
Differentiate between nested and inner class in java.
what is use of functional interface in java 8?
Why does java have different data types for integers and floating-point values?
What are advantages and disadvantages of OOPs?
Can one thread block the other thread?
Describe method overriding
What are the important features of Java 10 release?
What is the private method modifier?
What is java reflection api?
What do you understand by casting in java language?
Why 1 is not a prime number?
Why multiple inheritance is not supported by java?
What is the largest number a double can hold?