0
Need help with hashtable
not understanding the get method public v get(k k)
3 ответов
+ 1
Hashtable<String, String> ht = new Hashtable<>();
ht.put("name", "John Doe");
ht.put("age", "18");
System.out.println(ht.get("name")); //prints "John Doe"
System.out.println(ht.get("age")); //prints "18"
0
whats the difference between hashtable and hashmap
0
Hashtable is synchronized, HashMap is not. Usually it is better to use HashMap because Hashtable considered as legacy class and less flexible when you deal with complex algorithms, also when you working with threads you likely will be use your own synchronization algorithms so use of Hashtable loses its meaning at all.