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
Jeremy Mathew
852 Points"cannot find symbol" most of my methods have the issue "cannot find error" I am pretty sure that my code is correct.
Here are the errors:
/PezDispenser.java:24: error: invalid method declaration; return type required
pubic boolean isEmpty(){
^
./PezDispenser.java:24: error: cannot find symbol
pubic boolean isEmpty(){
^
symbol: class pubic
location: class PezDispenser
Example.java:11: error: cannot find symbol
if (dispenser.isEmpty()) {
^
symbol: method isEmpty()
location: variable dispenser of type PezDispenser
Example.java:16: error: cannot find symbol
if (!dispenser.isEmpty()) {
^
symbol: method isEmpty()
location: variable dispenser of type PezDispenser
Example.java:22: error: cannot find symbol
if (dispenser.isEmpty()) {
^
symbol: method isEmpty()
location: variable dispenser of type PezDispenser
./PezDispenser.java:17: error: cannot find symbol
if(!isEmpty()) {
^
symbol: method isEmpty()
location: class PezDispenser
./PezDispenser.java:25: error: incompatible types: unexpected return value
return pezCount == 0;
^
8 errors
3 Answers
andren
28,558 PointsGiving you an exact answer is difficult without seeing your code, but one thing I can say is that the second (and likely first) error is caused by a typo. You have written pubic when you meant to type public, you missed an l in the middle.
Fixing that typo could result in the rest of your errors disappearing, as a single error has a tendency to snowball into a bunch of other errors in Java. But without looking at your actual code I can't say for sure.
Vladut Astalos
11,246 PointsYou wrote 'pubic' instead of 'public'.
Jeremy Mathew
852 PointsThanks, guys really appreciate for some reason when I run the code it doesn't show all the errors on the console. Anyway to scroll up so I can see all of the errors?