Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trying to use Hash Map

 
Pete Malis
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;

 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic