• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol message

 
Joe Lemmer
Ranch Hand
Posts: 171
  • 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
  • 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
  • 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: 49808
69
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic