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 trialAditya Puri
1,080 PointsAn error
Ok so I made a new method which returned the value of "mPezCount".
I thought that whenever we make a new instance of the class the constructor would automatically set the value of the field variable "mPezCount" = 0 for that object.
But when I used java-repl to run that method and to get the value of mPezCount, I was expecting "0", but it gave me an error. Why is this so?
Matthew Garcia
7,520 PointsDaniel is correct. Your code is correct up to the point at which you call your getPezCount method.
You wrote: pd.getPezCount //Almost correct Correct solution: pd.getPezCount(); //You were missing the parentheses () and the semicolon ;
Good luck!
Daniel Springer
7,600 PointsDaniel Springer
7,600 Pointsif im reading that correctly you forgot to put the ending paranthases and semicolon ();
pd.getPezCount();
also be sure that your variable is of the correct casing either upper or lower, javas pretty picky about stuff like that XD