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

Robbie Moritz
Robbie Moritz
1,665 Points

Illegal Argument Exceptions -- Java

I have been having trouble with this step in the Java course. I feel that I wrote my code the same way the instructor has his, but when I try to execute I get Pages of errors.

I do not know what I have done wrong, it might be simple like a misplaced set of curly braces. Here is the link to my code. https://w.trhou.se/ewr8tohxr2

Please help if you see the problem.

That link isn't working - can you re-post it?

Robbie Moritz
Robbie Moritz
1,665 Points

I turned the link into a snapshot. I hope that I can get some help with it.

1 Answer

HI Robbie,

This isn't correct:

  public void fill() {
    fill(MAX_PEZ);
  } 

You're calling the method from inside itself. In this method you want to set pezCount to be equal to MAX_PEZ.

Try that and see if it clears your errors.

Steve.