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 trialJonathan Ramirez
6,284 PointsNoSuchMethodError for .load() and .isEmpty
Hi there,
When trying to run the code in the console, I've written it exactly as instructed in the video.
Can you have a look at my code and see if I've introduced any bugs?
<p> public class PezDispenser {
public static final int MAX_PEZ = 12;
private String mCharacterName;
private int mPezCount;
public PezDispenser (String characterName) {
mCharacterName = characterName;
mPezCount = 0;
}
public boolean isEmpty() {
return mPezCount == 0;
}
public void load() {
mPezCount = MAX_PEZ;
}
public String getCharacterName() {
return mCharacterName; </p>
}
}
1 Answer
Jon Sultana
6,916 PointsYou also have the opening paragraph tag in the beginning of the code.
Lucas Santos
19,315 PointsLucas Santos
19,315 PointsWhy is there a random closing paragraph tag at the end of your getCharacterName function?