• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

trying to use Hash Map

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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;

 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic