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

problems with challenge 3 of java basics

Hello

I've just spent the last hour trying to complete the following task on the java basics course;

Using the console's printf method, display a message that says, "First name: ", followed by the first name that the user has entered.

This is what I have ended up at (having tried more variables than I can keep track of now)

String firstName = console.readLine ("Manjinder"); String lastName = console.readLine ("Kang"); console.printf("s%", firstName);

and this is the error message I've had come back to me;

Bummer! Ensure your format string contains the required text "First name:".

I don't know what to do now. Please help

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine ("Stevie");
String lastName = console.readLine ("On the TV");
console.printf("s%", firstName);

2 Answers

Hi Grigorij

Thanks for your help, it's very much appreciated! corrected and challenge complete!

Thanks again

Manjinder

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Very cool !!!

See you in the forum :thumbsup:

Grigorij

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hi Manjinder,

you got two small errors:

First:

the string formatter looks like this %s and not s%.

Second:

Follow the instructions and print the text the challenge wants you to do:

Dont forget the First name: ....... or for the 4th part Last name...... inside the text

:smiley: