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 Java Objects (Retired) Harnessing the Power of Objects Incrementing

Patrick Alcorta
Patrick Alcorta
4,056 Points

while(!isFullyCharged()){ mBarsCount++; }

I think I got the code right but it is still giving me errors. I checked previous questions and they are all giving me the same answer yet I am still getting it wrong. Code below: while(!isFullyCharged()){ mBarsCount++; } I thoguht it might have been because I did not initialised the mBarsCount Variable so I initialised it to 0 but same issue getting an error. Any Suggestions?

1 Answer

Patrick Alcorta
Patrick Alcorta
4,056 Points

Please Ignore my ignorance..... I realised I did not put the while loop inside the charge method... all is good now

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

He Patrick,

no problem. Great you could solve it :)