This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes trying to use Hash Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "trying to use Hash Map" Watch "trying to use Hash Map" New topic
Author

trying to use Hash Map

Pete Malis
Greenhorn

Joined: Dec 05, 2008
Posts: 3
I have a Game class,Room class and an Item class for this.

The room has a hashmap and trying to put items in the room using a hashmap as well almost copying the room class. I get an error in game though when trying to access the method. In game it errors on the second line

Room nextRoom = currentRoom.getExit(direction);
Item nextItem = currentItem.getItem(itemCommand);


saying cannot find symbol - variable item command

my method are the same in the Room class



then I have



"cannot find symbol- variable item command"

[edit]Add code tags. CR[/edit]
[ December 08, 2008: Message edited by: Campbell Ritchie ]
Tom Johnson
Ranch Hand

Joined: May 11, 2005
Posts: 142
Use Code Tags!! as it makes your code much easier to read.

I assume this a compiler error "cannot find symbol-variable item command". It indicates that you are trying to reference a variable that has not been defined i.e. "item command". Where is the "itemCommand" String defined that is used in this line;



<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38057
    
  22
Please don't send anybody any zipped files; we want all discussion to be on the forum.
Have you posted the exact code you are using; there is nothing which would suggest such an error in what you have posted, and you cannot get an error message saying it can't find "item command" as two words.
Most likely explanation is that there is a tiny spelling error somewhere; try copying the parameter identifier into the get call arguments with ctrl-C ctrl-V.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trying to use Hash Map
 
Similar Threads
Locked door help
Using polymorphism with arraylist
is it an array i need?
symbol not found?
my inverted index not successfull