This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • 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
Pie
Posts: 50273
80
  • 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: 20669
65
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