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
Vitalij Kacanovskij
1,851 PointsGuys need help, can't understand my error in one IO exercise
Using the console's printf method, display a message that says, "Last name: " followed by the last name that the user has entered.
The error: Bummer! Did you forget to pass the lastName parameter to the printf function?
Code: // I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine ("Vitalij"); String lastName = console.readLine ("Kacanovskij");
console.printf("%s\n", firstName); console.printf("First Name:", firstName);
console.printf("%s\n", lastName); console.printf("Last name:", lastName);
1 Answer
markmneimneh
14,133 PointsHello
It hard to read the code as pasted but it looks ok? may be there is a typo. Your code should look like this for all 4 parts of the challenge.
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine();
String lastName = console.readLine();
console.printf("First name: %s", firstName);
console.printf("Last name: %s", lastName);
If this answers your question, please mark the question as answered.
Vitalij Kacanovskij
1,851 PointsVitalij Kacanovskij
1,851 PointsThank you for help Mark, it really has more logic in that... it simpler than i thought.