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

I'm not sure what to do here ?

Can someone please explain to me what I need to do here ?

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

I did replace the firstName variable with the %s formatter but I get an error saying

Bummer! Make sure that you use the firstName variable as the second argument

Here is the code:

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

1 Answer

Yanuar Prakoso
Yanuar Prakoso
15,196 Points

Hi Christiaan

You almost pass the challenge. All you have to do is removing the < > characters from < %s > inside your console.printf code. The code should be like this:

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

It is has to do with how the Treehouse test your code whether it passed the challenge or not. It test if your printed String which replaces <Your name> is the same as the String you put inside variable firstName. When you did not erase the < > the test declared that you put < Christiaan > in place of <Your Name> instead of just Christiaan.

That is all from me. I hope it can help a little.

Ah cant believe I missed that, I did what you said and it passed, thank you