• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ganeric type

 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

shouldnt it give the error?if not then then whats the reason?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are usually better using the HashMap<K, V> class, but there is nothing wrong with the code you posted.
Also, it would be better to declare the reference as Map<String, String>.

[edit]Change Hashmap to HashMap.[/edit]
[ September 16, 2008: Message edited by: Campbell Ritchie ]
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't give you an error (since a Hashtable<String,String> still is a Hashtable), but later on you will most definitely get some warnings - either when trying to add something or when casting back to Hashtable<String,String>.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic