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 trialHarland White
1,771 PointsNow replace <YOUR NAME> in the console.printf expression with the firstName variable using the string formatter.
What isn't my code working?
// I have setup a java.io.Console object for you named console
String firstName = "Harland";
console.printf ("%s can code in Java!", firstName);
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Harland,
It's just a small spacing error you have. You cannot have a space between the method name and the opening parenthesis. When you add a space, the compiler doesn't know that it is part of the method call. Just delete the space and it's all good to go. :)
andren
28,558 Pointsandren
28,558 PointsSmall correction, while it is true that the space is what is making his code not pass this challenge, that is because of an issue with the challenge checker. Not with the Java compiler itself.
It is perfectly valid to have a space between method names and their parenthesis, you can even put the parenthesis on a separate line if you want. As long as the semicolon is in the right place Java doesn't really care about spacing all that much.
Having a space between method names and their parenthesis is unconventional for sure, but completely valid code wise.
Harland White
1,771 PointsHarland White
1,771 PointsThank you!