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

error: make sure you add '%s' formater string.

On the third challenge I've got: make sure you add '%s' formater string, while I already have added %s, and it's changing the name correctly in the previous challenges. Could anyone give me a hand? :) Thank you

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

1 Answer

Dennis Mårtensson
Dennis Mårtensson
7,400 Points

The second line in your code is unnecessary. It's only asking you to print one line. Also, you don't need the '\n' in your string. Like this;

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

Thank you very, very much! ^_^