wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes ganeric type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ganeric type" Watch "ganeric type" New topic

ganeric type

geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78

shouldnt it give the error?if not then then whats the reason?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36453
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

Joined: Oct 27, 2005
Posts: 19538

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>.

How To Ask Questions How To Answer Questions
I agree. Here's the link: http://aspose.com/file-tools
subject: ganeric type
Similar Threads
Recursive Methods
better way?
Hashtable allowing null values
Best way to do generics?
Strings and Hashtables