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

string formatter

isn't ("%s can code in java", firstName"); the right string formatter

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

2 Answers

andren
andren
28,558 Points

Your code is indeed correct. However one thing worth noting is that while it is technically valid to have spaces between methods and their parenthesis in Java, it is not a common thing to do. Most Java programmers never place spaces between methods and their parenthesis, and since that is considered the norm the code checker for these challenges is tailored to expect your code to not have that space. Therefore even though your code is technically valid the code checker ends up mistaking it as invalid.

So all you need to do is remove that space like this:

String firstName = "Ben";
console.printf("%s can code in java", firstName);

And your code will pass the challenge.

thank you it worked