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

Java Challenge

What am I doing wrong? This is extremely frustrating.

String firstName = "Momzy";
console.printf("Hello, my name is %s\n", firstName);
console.printf("%s is learning how to write Java\n", firstName);
console.printf("%s can code in Java\n", firstName);

Bummer! Make sure you add the %s formatter

What the heck?

2 Answers

Hello there,

I think there's just an issue here with the challenge looking specifically for the line it asked you to print, and no more. Since your code is printing three lines and it only asks for one, I think it's just throwing things off. When I remove the two lines it doesn't ask for and just leave the one it does, it passes - you're using the %s correctly.

Final should look like this:

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

Thank you so much! This worked. I am so grateful.

Raffael Dettling
Raffael Dettling
32,999 Points

Only use the last last printf and don´t forget the ! after Java :)

Thank you very much. This helped a lot.