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.

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:

Name.java
// 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,195 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