This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol message

 
Joe Lemmer
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm getting an annoying cannot find symbol message when trying to compile my 'GamePlayer' class. The message reads:

cannot find symbol
symbol : method setName(java.lang.String)
location : class Player
one.setName("Adam");

the pointer points to the point full stop before setName. The message repeats for every one of my Player objects.

I can't quite see what I'm doing wrong and would be grateful for any help.

Thanks

Joe

This is the code for my GamePlay class



This is the code for my Player class:

 
Joe Lemmer
Ranch Hand
Posts: 171
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry everyone. Please don't spend any time on this, I'm just being an idiot. When I changed my Player class to include the setName method, I forgot to recompile it. Doh!
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Lemmer:
I forgot to recompile it.


no problem. it is a common mistake
 
Campbell Ritchie
Sheriff
Pie
Posts: 47250
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably better to set the name in the constructorThen you don't need the setName method, unless you think your Players will change their names in mid-game!
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic