Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ganeric type  RSS feed

 
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: 53773
128
  • 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
Posts: 20895
81
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>.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!