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 trial

Java Java Basics Getting Started with Java IO

What did I do wrong

What did I do wrong

IO.java
// 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);
Bramyn Payne
Bramyn Payne
19,589 Points

Make 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

1 Answer

Tsenko Aleksiev
Tsenko Aleksiev
3,819 Points

The 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 :)