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 trialryan backert
75 PointsWhat did I do wrong
What did I do wrong
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("what is your name? ");
String lastName = console.readLine("Ryan");
console.printf =("%s",firstName);
1 Answer
Tsenko Aleksiev
3,819 PointsThe idea here ( without telling you exactly what to do ) is: console asks "What is your name? " - you type in your name and what you have typed is saved in the variable firstName console asks ( I assume ) "What is your last name? " - you type in your last name and the same is saved in the second variable lastName. Than, using formatted print ( printf() ) you are telling Java to place in this placeholder "%s" ( s means String ), the variable you give to it, in your case firstName. Without seeing the condition, I believe it would be something like printf("%s %s", firstName, lastName). Think about it :)
Bramyn Payne
19,589 PointsBramyn Payne
19,589 PointsMake sure to read the directions carefully.
It asks to display "First name: " followed by the first name entered, so the output would like like this:
First name: firstName