vipin pal

Greenhorn
+ Follow
since Jul 18, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vipin pal

here is code :
import java.util.*;
class abc
{
public static void main(String[] args)
{
Hashtable hm=new Hashtable();
for (int i=0;i<5;i++ )
{
hm.put("i","vipin"+String.valueOf(i));
System.out.println("Hello World!"+i+"\t"+hm.get("i"));
}
line-1System.out.println("Hello World!"+hm.get("i"));
line-2System.out.println("Hello World!"+hm.get("4"));
}
}
my question is i am using hashtable put and get methods for storing and retrieving values.i store values using "i" as integer variable in double quotes(b'cos method accept object)but when i retrieve values using variable "i" in line 1 it gives out put using i=4 but when i direct put the value of key i=4 as in line 2 it gives null value ?? why??
19 years ago