Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Compiler error: can't find symbol. Following instructions exactly.

I seem to have replicated Craig's code exactly, but I'm getting the "cannot find symbol" compiler error seen in the snapshot here:

https://w.trhou.se/lk6k7l4q95

What am I doing wrong here?

Edit: didn't realize the snapshot wouldn't show the compiler, lol. I get the error "cannot find symbol dispenser.getCharacterName());, with the arrow pointing underneath the period right before the method.

3 Answers

Hi Kasey,

There's a typo - change dispenser.getCharcterName() to dispenser.getCharacterName().

Steve.

Ahh, of course. Another typo. I've got to get better at finding those, lol. Thanks again, Steve!

No problem! :+1:

If you get the error can't find symbol it means you've used a word that the compiler doesn't understand.

This can happen in a few scenarios:

  • You used a variable name before you declared it
  • You spelled a variable or method name incorrectly
  • You've used a variable name that's out of scope

So, check for those things if you get this error.

Steve.