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 trialDevin Ray
40 Pointswhat is the error on line 3?
question
// I have setup a java.io.Console object for you named console
String firstName="Devin Ray";
console.printf("Devin Ray");
Devin Ray
40 PointsI tried this and it didnt work
1 Answer
Lauren Moineau
9,483 PointsEdit. Revisiting this today (25/01/2019) and it looks like the challenge has changed. Or maybe I just checked part 1 with the other given answer. I'm not sure what happened.
My initial answer (Hi Devin. Vidhur Savyasachin 's answer is correct. It will work,) actually was not quite right.
Anyway, Devin Ray, if you're still struggling:
- Part 1 : create a String variable that stores your name - You did that perfectly in line 2 (line 1 is the comments in grey)
- Part 2: call the printf method on the console to make it write "<YOUR NAME> can code in Java!" - That's your line 3. You did great but the message to write is incomplete. You need to add "can code in Java!" to your name.
- Part 3: you need to format the message, replacing your name with %s and adding firstName (the variable that stores your name) after the message String.
Hope that helps :)
Vidhur Savyasachin
6,678 PointsVidhur Savyasachin
6,678 PointsString firstName = "Devin Ray"; console.printf("%s is my First name",firstName);
This should work.