import java.util.*;
public class Where
{
public static void main(String args[])
{
HashMap h=new HashMap();
h.put(111, "ram");
h.put(112, "neha");
h.put(113, "hem");
h.put(114, "sallu");
Set s=h.entrySet();
Iterator it=s.iterator();
while(it.hasNext())
{
Map.Entry me=(Map.Entry)it.next();
System.out.println("me.getKey():" +me.getKey());
System.out.println("me.getValue():" +me.getValue());
}
System.out.println();
}
}
public class Where
{
public static void main(String args[])
{
HashMap
h.put(111, "ram");
h.put(112, "neha");
h.put(113, "hem");
h.put(114, "sallu");
Set s=h.entrySet();
Iterator it=s.iterator();
while(it.hasNext())
{
Map.Entry me=(Map.Entry)it.next();
System.out.println("me.getKey():" +me.getKey());
System.out.println("me.getValue():" +me.getValue());
}
System.out.println();
}
}
output:-
for compile-
E:\sallu>javac Where.java
for run-
E:\sallu>java Where
me.getKey():114
me.getValue():sallu
me.getKey():113
me.getValue():hem
me.getKey():112
me.getValue():neha
me.getKey():111
me.getValue():ram
E:\sallu>
E:\sallu>javac Where.java
for run-
E:\sallu>java Where
me.getKey():114
me.getValue():sallu
me.getKey():113
me.getValue():hem
me.getKey():112
me.getValue():neha
me.getKey():111
me.getValue():ram
E:\sallu>
No comments:
Post a Comment