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 trialKevin Barry
1,090 PointsHaving a hard time on task 3 of the Strings and Variable objective.
Bummer! Please make sure you leave your printf statement intact
// I have setup a java.io.Console object for you named console
String firstName= "Kevin";
console.printf ("%s can code in Java!", firstName);
2 Answers
andren
28,558 PointsYour code is technically valid, but the test for the third task is pretty picky about how your code is formatted. It won't accept your code if there is a space between the printf
method name and its Parentheses. If you remove that space like this:
String firstName= "Kevin";
console.printf("%s can code in Java!", firstName);
Then your code will be accepted. It's worth keeping in mind that while the code you had originally is technically valid it is pretty rare to have spaces between methods and their parenthesis, not having a space is more common. So I would recommend adapting that style for future challenges in order to avoid running into similar problems.
Kevin Barry
1,090 PointsThank You!
Jason Anders
Treehouse Moderator 145,860 PointsHey Kevin,
The error you are getting for the third task is misleading and unjustified. While, technically, having whitespace between the method and the opening parentheses shouldn't matter, it does for this challenge. Just delete the space and the challenge will pass.
Tagging Craig Dennis for confirmation/clarification. :)
Kevin Barry
1,090 PointsThank you!
Antonio De Rose
20,885 PointsAntonio De Rose
20,885 PointsTry, run the file again, I do not see anything wrong, for me, your code did work, just the way I copied from above.