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 trialFernando Lopez
339 PointsWhat is the answer to the challenge task 3 in IO section ? I've been stuck on that one for two days . please help !
I just don't understand how it wants me to write it out ..
// I have imported java.io.Console for you. It is a variable called console.
1 Answer
Stephen Bone
12,359 PointsHi Fernando
So you're stuck on task 3 so you're code so far must look something like below?
String firstName = console.readLine("Please enter your first name: ");
String lastName = console.readLine("Please enter your last name: ");
In that case what it asks is to use the printf method to format the message "First name: " and pass the firstName variable into it. This takes the format of the code below.
console.printf("First name: %s", firstName);
The %s acts as a place holder for string data types and then tell it which variable to put in its place. Task 4 asks for the same thing but using last name so that should give you the chance to tweak the code a little.
Hope it helps!
Stephen
Fernando Lopez
339 PointsFernando Lopez
339 PointsThanks for the help ! I truly appreciate it.