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 trialAlex Vu
119 PointsWhat is challenge task 2of3 even asking me to do? i dont understand. i get bummer check the spelling
i'm getting check the spelling of the argument to the printf method. this isnt making sense to me
2 Answers
Alex Vu
119 PointsString firstName = "Apple"; console.printf("%s loves apples.", firstName);
Rui Bi
29,853 PointsAre you sure you are spelling the variable name of your string right? Also make sure you are not accidentally using quotes to wrap around the argument.
Lets say you have a String text which stores the word, "apples," and you want to print out, "I love apples."
Then your code would look like: String text = "apples"; console.printf("I love %s", text);
You use %s to indicate where you want the String to appear in the print out, and pass the variable name of the String as the second argument.
Alex Vu
119 Pointsi've tried your code but it doesnt work. String firstName = "Apple"; console.printf("I love %s.", firstName); i had to change the text cause it was asking me to use camelCase. i've also tried using string as a name. String firstName = "Apple"; console.printf("%s loves apples.", firstName); please help me good sir.
Rui Bi
29,853 PointsI just redid the challenge, and passed all 3 stages with this code:
// I have setup a java.io.Console object for you named console
String firstName = "Appple";
console.printf("%s can code in Java!", firstName);
Alex Vu
119 PointsAlex Vu
119 PointsThanks Rui, i copied and pasted your script but i changed appple to jason and it didnt work, i also tried apple and still no go. so i went ahead and cheated and just used your script.