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


console.printf("I need help with the Pez Dispenser.")

Hello, I´m doing the pez challenges again to review, and I´ve got the Example and PezDispenser files filled out but the compiler wont work and i don´t understand what it´s telling me. any help?

-Example.java- 1) public class Example 2) public static void main(String[] args) { 2) System.out.println("Woo a new pez thing is on the way!"); 4) PezDispenser pez = new PezDispenser("Bob"); 5) System.out.println("The new pez thing will be called %s\n", pez.getCharacterName()); 6) } 7) }

-PezDispenser.java- 1) public class PezDispenser { 2) private String mCharacterName; 3) 4) public PezDispenser (String characterName) { 5) mCharacterName = characterName; 6) } 7) 8) public String getCharacterName() {
9) return mCharacterName; 10) } 11) }

can you upload your code in the workspace format and copy and paste the question as it is

1 Answer

Craig Dennis
Craig Dennis
Treehouse Teacher

This line:

System.out.println("The new pez thing will be called %s\n", pez.getCharacterName());

Should be using printf for printing formatted code.

OOOhh I remember you mentioning that now