Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Joseph Nickalo
432 Pointsconsole.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) }
1 Answer

Craig Dennis
Treehouse TeacherThis line:
System.out.println("The new pez thing will be called %s\n", pez.getCharacterName());
Should be using printf
for printing formatted code.

Joseph Nickalo
432 PointsOOOhh I remember you mentioning that now
Admire Dhodho
5,411 PointsAdmire Dhodho
5,411 Pointscan you upload your code in the workspace format and copy and paste the question as it is