I am working with Hashtable
in my java program. I just surprised by seeing the abnormal behavior of Hastable
. Below is my code (This is not my final code, i simply created a new simple project with the code which is running abnormal)
Hashtable<char[], char[]> h1 = new Hashtable<char[], char[]>();
char[] key = Integer.toString(12).toCharArray();
char[] val = Integer.toString(21).toCharArray();
h1.put(key, val);
System.out.println(h1.containsKey(Integer.toString(12).toCharArray()));// Should print true, since 12 is there in Hashtable