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
Steven Hormell
160 PointsJava, Code Challenge: IO Task 3 of 4
could someone please tell me what's wrong with the code?
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("What's your name? ");
String lastName = console.readLine("What's your last name? ");
console.printf("%s %s", firstName, lastName);
1 Answer
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsNothing wrong : its perfectly fine. Task 3 however asks you:
Using the console's printf method, display a message that says, "First name: ", followed by the first name that the user has entered.
If that is the step you are onto, then you have to print literally "First name:" and then firstName value, like this:
console.printf("First name:%s", firstName);