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 trialMichael Noble
Courses Plus Student 215 PointsWhat am I missing here?
I keep getting an error, No clue what I missing. I fairly new to this...
// I have setup a java.io.Console object for you named console
String firstName = "Mike";
consel.printf("%s can code in Java\n,");
1 Answer
andren
28,558 PointsThere are a couple of issues with your code:
You have a typo in your second line,
consel
should beconsole
.When you use the
%s
placeholder with theprintf
method you are tellingprintf
to replace that placeholder with some variable. The thing is that you have to specify what variable you want to insert into the string. You do that by placing a comma outside the string and then writing the name of the variable.These challenges tend to be very picky about strings, the string you write usually has to match the example string exactly to the dot. In your string you place a line break and a comma at the end which is not present in the example string. Which will cause the code checker to mark your code as invalid.
If you fix all of those issues you end up with this code:
String firstName = "Mike";
console.printf("%s can code in Java", firstName);
Which will pass the test.