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 trialThomas Wold
2,309 PointsI don't understand why this isn't working. Can someone plz explain. Java Objects Incrementing
I've been stuck on this challenge for awhile now. I've watched the video several times and just cant seem to understand what the errors are telling me or how to correct it. ./GoKart.java:17: error: cannot find symbol while (!isFullyCharged); ^ symbol: variable isFullyCharged location: class GoKart ./GoKart.java:18: error: cannot find symbol charge++; ^ symbol: variable charge location: class GoKart 2 errors
2 Answers
Steve Hunter
57,712 PointsHi there,
You're using the method isFullyCharged()
- that requires the brackets:
while(!isFullyCharged()){
// do stuff
}
"Cannot find symbol" means you've used a variable name that you haven't defined or there's some other reason the compiler doesn't know what to do with a word you have written.
Can you post your code as there's another error in there about the ++ operator. I think you might have typed charge++
when you want to increment the value of mBarsCount
, I think. That should be mBarsCount++;
I hope that helps !
Steve.
Thomas Wold
2,309 PointsThanks so much, I had forgotten the brackets as well as used charge++ instead of mBarsCount++.
Steve Hunter
57,712 PointsNo problem. Glad you got sorted! :-)