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

Rashida Range
Rashida Range
209 Points

Huh? Why is this syntax not working? I entered it exactly how it should be...please help :)

After trying 6 times...this last part of the quiz got me...not sure why it's wrong because the output reads correctly.

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

3 Answers

Seth Kroger
Seth Kroger
56,413 Points

There should be no space between printf and the parenthesis:

console.printf("%s can code in Java!", firstName);
Rashida Range
Rashida Range
209 Points

Thanks! I thought I was going crazy!

andren
andren
28,558 Points

Your code is fine, this is an issue with the fact that the code checker that these challenges use is often very picky, and will often mark code as wrong even though it produces the desired result. If that result is not obtained with the exact code it is expecting.

The problem is that the check it does on task 3 expects your printf statement to look exactly like this:

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

Notice that there is no space between the printf and the opening parenthesis. While it is valid to have a space between them, it is more common to not have a space. So that is what the code checker is expecting your code to look like.

So all you need to do to pass the challenge is to remove the space between the so that your printf line looks like the one above.

Rashida Range
Rashida Range
209 Points

very picky!! LOL...thanks! Thought I was going crazy!