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

Android

Andrew Zhang
Andrew Zhang
4,364 Points

Android Defaulting Parameters Challenge

I'm trying to do the challenge off editing a shopping card, when I check work, it tells me:"Did you uncomment the line in Example.java? The output from System.out does not show the 1 Yoda PEZ dispenser."

However, I have uncommented that line.

This is what I added into the ShoppingCart.java:

public void addItem(Product item){
    System.out.printf("1 %s\n", item.getName());
  }

Please let me know what I'm doing wrong?

Lim Shan Kuo
Lim Shan Kuo
16,049 Points

I had similar problem but when I try to the above Example.java, ShoppingCart.java and Product.java code on the local java compile and execution. The System.out does show '1 Yoda PEZ dispenser". I'm confused of teamtreehouse challenge console claims System.out does not show that message.

Andrew Zhang
Andrew Zhang
4,364 Points

Hi Lim Shan Kuo

the way I solved my problem was to just refresh the page or reloaded the question.

seem to have fixed it.

let me know how you go.

I am having the same problem as well. Is there a reason why the Treehouse console is not showing the message "1 Yoda PEZ dispenser"? My code looks exactly the same as the one posted by Andrew, and I've tried refreshing the page multiple times but the error still exists.

1 Answer

Lim Shan Kuo
Lim Shan Kuo
16,049 Points

It works, when I refresh the web browser, redo the question but I add the word System.out.printf( "Added 1 %s to the cart" , item.getName());

Maybe it may work after refresh the web browser and nothing to do with adding just one word 'Added'. I just dont' have clue to how challenge code check that answers for that that question.