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 trialLaura Mckay
599 Pointsformat specifier
Following what the video said, but getting error.
Also, in last tutorial the comma was throwing an error, so put a plus and it worked. This was not what was shown in the videos however. Very confusing.
// I have setup a java.io.Console object for you named console
String firstName = "Laura";
console.printf("%s Can code in java", firstName);
1 Answer
andren
28,558 PointsThe code checker for these challenges can be extremely picky about the text output of your program, when they ask you to write a certain string they often expect it to match that string exactly including the same spacing and casing.
The issue with your string is that the C
in can
is capitalized which it should not be according to the example string they provided for you. If you write it without a capital C
you will be able to pass the challenge.
As for your other complaint can you post the code that was causing an issue? It's hard to explain exactly what was wrong without seeing the code.
The +
operator is used to combine two different strings but should not be necessary to use if you use printf
with a string placeholder. Maybe you left out the placeholder or used some other print method like print
or println
by accident?
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherJust wanted to add a side note here. Andren is 100% correct about the challenges checking for spelling, capitalization, spacing, and punctuation. So on that note, I'd like to add that you also didn't capitalize the "J" in "Java" and your string is missing an exclamation point at the end (!). Hope this helps!
andren
28,558 Pointsandren
28,558 PointsOps you are correct I did miss that. Though it's worth noting that I almost always verify that the advice I give is enough to pass the task in question before posting. So while there are more issues than the one I pointed out I did verify that simply changing
Can
tocan
was enough to complete the challenge.The code checker while picky does occasionally accept strings with some variations. It's just very inconsistent and hard to predict what it accepts and what it doesn't unless you copy the example provided exactly.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherI have no doubt that you validated the completion of the challenge, andren. Your answers are always very on point. But, as you pointed out, it's a good idea to get in the habit of making sure that strings match exactly and avoid frustration later
andren
28,558 Pointsandren
28,558 PointsIndeed, we are both in agreement on that point .
Laura Mckay
599 PointsLaura Mckay
599 PointsThanks a lot to both of you! I managed to proceed on the next point. :)