i write code like this
[CODE=java]import java.util.*;
class TreeMapDemo
{
public static void main(String[] args)
{
Map tm=new TreeMap();
tm.put(" ravi " , new Double(23423.22 ));
tm.put(" raja " , new Double(45454.33 ));
tm.put(" anil " , new Double(77666.32 ));
tm.put(" mega " , new Double(34342.55 ));
tm.put(" giga " , new Double(98666.22 ));
tm.put(" hecta " , new Double(-32.22));
Set set=tm.entrySet ();
Iterator i=set.iterator( );
while(i.hasNext ())
{
Map.Entry me=(Map.Entry)i .next();
System.out.prin tln(me.getKey() + " :");
System.out.prin tln(me.getValue ());
}
System.out.prin tln();
double balance=((Doubl e)tm.get("Kiran Kumar")).double Value();
tm.put(" Kiran Kumar",new Double(balance + 1000));
System.out.prin tln(" Kiran Kumar's new balance :" +
tm.get("Kiran Kumar"));
}
}[/CODE]
it will show some error at tm.put linesssssssssss sssssssssssssss ssss
[CODE=java]import java.util.*;
class TreeMapDemo
{
public static void main(String[] args)
{
Map tm=new TreeMap();
tm.put(" ravi " , new Double(23423.22 ));
tm.put(" raja " , new Double(45454.33 ));
tm.put(" anil " , new Double(77666.32 ));
tm.put(" mega " , new Double(34342.55 ));
tm.put(" giga " , new Double(98666.22 ));
tm.put(" hecta " , new Double(-32.22));
Set set=tm.entrySet ();
Iterator i=set.iterator( );
while(i.hasNext ())
{
Map.Entry me=(Map.Entry)i .next();
System.out.prin tln(me.getKey() + " :");
System.out.prin tln(me.getValue ());
}
System.out.prin tln();
double balance=((Doubl e)tm.get("Kiran Kumar")).double Value();
tm.put(" Kiran Kumar",new Double(balance + 1000));
System.out.prin tln(" Kiran Kumar's new balance :" +
tm.get("Kiran Kumar"));
}
}[/CODE]
it will show some error at tm.put linesssssssssss sssssssssssssss ssss
Comment