aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ganeric type" Watch "ganeric type" New topic
Author

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
Sheriff

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

Joined: Oct 27, 2005
Posts: 19693
    
  20

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ganeric type