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 Java Basics Getting Started with Java Strings, Variables, and Formatting

andrea Tringo
andrea Tringo
616 Points

Why am I getting "...make sure your printf statement is intact" message in quiz?

-This is the question (task 3 in the quiz):

Now replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter.

-Here's my code; I don't get why it's wrong:

String firstName = "Pixie"; console.printf ("Pixie can code in Java!"); console.printf ("%s can code in Java!", firstName);

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Pixie";
console.printf ("Pixie can code in Java!");
console.printf ("%s can code in Java!", firstName);

1 Answer

Chase Marchione
Chase Marchione
155,055 Points

Hi andrea,

You're very close: all you need to do is remove the spaces between your method calls and your arguments.

// I have setup a java.io.Console object for you named console
String firstName = "Pixie";
console.printf("Pixie can code in Java!");
console.printf("%s can code in Java!", firstName);