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!

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) Delivering the MVP Defaulting Parameters

2,124 Points

Java Objects Challenge - Signature Method. I am making an error and cannot see the error: where can I get help?

I am stuck on Java Objects Challenge Task for signature method:

public String addItem(Product item) {
   return addItem(Product item, 1);

I have tried numerous variations but get compile errors

check the addItem() methods. One of them takes one parameter and the other takes two parameters. The one you are trying to call inside addItem(Product item) should take two parameters "item" and "one". It should look like return addItem(item, 1); ... In your example you are declaring the variable Product instead of just passing it to the method.

1 Answer

Craig Dennis
Craig Dennis
Treehouse Teacher

Hmmm...you seem to be passing the type Product when you are calling the method. Try it without that.