Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes error initializing hashmap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error initializing hashmap" Watch "error initializing hashmap" New topic
Author

error initializing hashmap

leroy tsruya
Ranch Hand

Joined: Sep 24, 2009
Posts: 57
Hi all!
i keep getting errors for this line:

it says that it doesnt find Classes T and S

but these are wildcards...

Thanks!
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18531
    
  40

Wildcards are specified with a "?" question mark. You can also bound it with "extends" and "super", but even then, you need to specify with a "?".

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Shashank Rudra
Ranch Hand

Joined: Mar 26, 2009
Posts: 131
this is not how we create generic while declaring reference variables. That is when we are defining generics for classes and methods. For defining reference variables Generic in nature instead we use <?>, <? extends> and <? super>. That depends on what is our need. Those details can be found in Core java books. I would prefer to look into Kathie's book.


Programmer Analyst || J2EE web development/design
leroy tsruya
Ranch Hand

Joined: Sep 24, 2009
Posts: 57
Thank you guys, i figured my mistake.
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error initializing hashmap
 
Similar Threads
Queue Implementation in Java - Source Code please?
Stack Implementation in Java - Source Code please?
Linked List Implementation in Java - Source Code please?
Subclassing Hashtable with generics?
extending an arraylist\hashmap