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

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

Henry Wong

Joined: Sep 28, 2004
Posts: 20517

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


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.
I agree. Here's the link:
subject: error initializing hashmap
It's not a secret anymore!